Skip to content

Commit 7b566b7

Browse files
committed
gh-157889: fix breaking tests for emscripten.
Emscripten apparrently defines O_PATH and readlinkat - even though it doesn't actually support them. This broke auto-detection of whether os.readlink supports FDs - which broke the tests.
1 parent f96963a commit 7b566b7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎Modules/posixmodule.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10991,7 +10991,15 @@ os_unshare_impl(PyObject *module, int flags)
1099110991
#endif
1099210992

1099310993

10994+
1099410995
#if defined(HAVE_READLINK) || defined(MS_WINDOWS)
10996+
10997+
#if (defined(__linux__) || defined(__ANDROID__)) && defined(O_PATH)
10998+
// readlinkat(fd, "", ...) reads the symlink that fd refers to.
10999+
// supported since Linux 2.6.39 (same version that O_PATH was introduced).
11000+
#define _Py_READLINKAT_SUPPORTS_EMPTY_PATH
11001+
#endif
11002+
1099511003
/*[clinic input]
1099611004
os.readlink
1099711005

@@ -11045,7 +11053,7 @@ os_readlink_impl(PyObject *module, path_t *path, int dir_fd)
1104511053
"freadlink() is unavailable");
1104611054
return NULL;
1104711055
}
11048-
#elif defined(HAVE_READLINKAT) && defined(O_PATH)
11056+
#elif defined(HAVE_READLINKAT) && defined(_Py_READLINKAT_SUPPORTS_EMPTY_PATH)
1104911057
// linux/android:
1105011058
// readlinkat(fd, "", ...) reads the link that fd refers to.
1105111059
if (HAVE_READLINKAT_RUNTIME) {

0 commit comments

Comments
 (0)