Visitar URL original
Add os.supports_dir_fd to test.pythoninfo by encukou · Pull Request #158605 · python/cpython · GitHub
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add os.supports_dir_fd to test.pythoninfo
Split the attribute lists so the 'supports_*' names don't need
to be repeated twice.

Add 'supports_dir_fd'.
  • Loading branch information
encukou committed Oct 2, 2026
commit a02eac03f230d0f1e2d91bdb8bd5216abbab7b0c
20 changes: 11 additions & 9 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,23 @@ def collect_urandom(info_add):
def collect_os(info_add):
import os

def format_attr(attr, value):
if attr in ('supports_follow_symlinks', 'supports_fd',
'supports_effective_ids'):
return str(sorted(func.__name__ for func in value))
else:
return value

attributes = (
plain_attributes = (
'name',
'supports_bytes_environ',
)
copy_attributes(info_add, os, 'os.%s', plain_attributes)

def format_set_of_functions(attr, value):
return str(sorted(func.__name__ for func in value))

supports_attributes = (
'supports_dir_fd',
'supports_effective_ids',
'supports_fd',
'supports_follow_symlinks',
)
copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr)
copy_attributes(info_add, os, 'os.%s', supports_attributes,
formatter=format_set_of_functions)

for func in (
'cpu_count',
Expand Down
Loading