Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbcc6ee

Browse files
committed
Put statx in correct os sets, and include in pythoninfo
1 parent 8ee94aa commit bbcc6ee

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Lib/os.py

+8
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def _add(str, fn):
118118
_add("HAVE_OPENAT", "open")
119119
_add("HAVE_READLINKAT", "readlink")
120120
_add("HAVE_RENAMEAT", "rename")
121+
_add("HAVE_STATX", "statx")
121122
_add("HAVE_SYMLINKAT", "symlink")
122123
_add("HAVE_UNLINKAT", "unlink")
123124
_add("HAVE_UNLINKAT", "rmdir")
@@ -140,6 +141,7 @@ def _add(str, fn):
140141
_add("HAVE_FUTIMENS", "utime")
141142
_add("HAVE_FUTIMES", "utime")
142143
_add("HAVE_FPATHCONF", "pathconf")
144+
_add("HAVE_STATX", "statx")
143145
if _exists("statvfs") and _exists("fstatvfs"): # mac os x10.3
144146
_add("HAVE_FSTATVFS", "statvfs")
145147
supports_fd = _set
@@ -1099,6 +1101,12 @@ def statx(path, mask, *, dir_fd=None, follow_symlinks=True, flags=0):
10991101
"""
11001102
return (stat if follow_symlinks else lstat)(path, dir_fd=dir_fd)
11011103

1104+
# Ensure our supports sets include us based on the fallback functions
1105+
supports_fd.add(statx)
1106+
if stat in supports_follow_symlinks:
1107+
supports_follow_symlinks.add(statx)
1108+
if stat in supports_dir_fd:
1109+
supports_dir_fd.add(statx)
11021110

11031111
if name == 'nt':
11041112
class _AddedDllDirectory:

Lib/test/pythoninfo.py

+2
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def format_attr(attr, value):
213213
)
214214
copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr)
215215

216+
info_add('os.HAVE_STATX', hasattr(sys.modules[os.name], 'statx'))
217+
216218
for func in (
217219
'cpu_count',
218220
'getcwd',

0 commit comments

Comments
 (0)