Skip to content

Commit 5881b2a

Browse files
Fix OpenIndiana.
1 parent 4ba224e commit 5881b2a

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

Lib/test/test_posix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,8 +1531,9 @@ def test_link_follow_symlinks(self):
15311531
link = orig + 'link'
15321532
posix.link(symlink, link)
15331533
self.addCleanup(os_helper.unlink, link)
1534-
default_follow = sys.platform.startswith(('darwin', 'freebsd', 'netbsd', 'openbsd', 'dragonfly'))
1535-
default_no_follow = sys.platform.startswith(('win32', 'linux', 'sunos5'))
1534+
default_follow = sys.platform.startswith(
1535+
('darwin', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'sunos5'))
1536+
default_no_follow = sys.platform.startswith(('win32', 'linux'))
15361537
if os.link in os.supports_follow_symlinks or default_follow:
15371538
self.assertEqual(posix.lstat(link), posix.lstat(orig))
15381539
elif default_no_follow:

Misc/NEWS.d/next/Library/2025-04-14-17-24-50.gh-issue-81793.OhRTTT.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Fix :func:`os.link` on platforms (like Linux and OpenIndiana) where the
2-
system :c:func:`!link` function does not follow symlinks. On Linux and
3-
OpenIndiana, it now follows symlinks by default and if
1+
Fix :func:`os.link` on platforms (like Linux) where the
2+
system :c:func:`!link` function does not follow symlinks. On Linux,
3+
it now follows symlinks by default and if
44
``follow_symlinks=True`` is specified. On Windows, it now raises error if
55
``follow_symlinks=True`` is passed. On macOS, it now raises error if
66
``follow_symlinks=False`` is passed and the system :c:func:`!linkat`

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,12 +4364,12 @@ os_link_impl(PyObject *module, path_t *src, path_t *dst, int src_dir_fd,
43644364
}
43654365
/* See issue 41355: link() on Linux works like linkat without AT_SYMLINK_FOLLOW,
43664366
but on Mac it works like linkat *with* AT_SYMLINK_FOLLOW. */
4367-
#if defined(MS_WINDOWS) || defined(__linux__) || (defined(__sun) && defined(__SVR4))
4367+
#if defined(MS_WINDOWS) || defined(__linux__)
43684368
if (follow_symlinks == 1) {
43694369
argument_unavailable_error("link", "follow_symlinks=True");
43704370
return NULL;
43714371
}
4372-
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
4372+
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || (defined(__sun) && defined(__SVR4))
43734373
if (follow_symlinks == 0) {
43744374
argument_unavailable_error("link", "follow_symlinks=False");
43754375
return NULL;

0 commit comments

Comments
 (0)