Skip to content

Commit c35ca4c

Browse files
[3.13] Add os.supports_dir_fd to test.pythoninfo (GH-158605) (#159059)
Add os.supports_dir_fd to test.pythoninfo (GH-158605) Split the attribute lists so the 'supports_*' names don't need to be repeated twice. Add 'supports_dir_fd'. (cherry picked from commit eb77b4b) Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent d73971f commit c35ca4c

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎Lib/test/pythoninfo.py‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,23 @@ def collect_urandom(info_add):
245245
def collect_os(info_add):
246246
import os
247247

248-
def format_attr(attr, value):
249-
if attr in ('supports_follow_symlinks', 'supports_fd',
250-
'supports_effective_ids'):
251-
return str(sorted(func.__name__ for func in value))
252-
else:
253-
return value
254-
255-
attributes = (
248+
plain_attributes = (
256249
'name',
257250
'supports_bytes_environ',
251+
)
252+
copy_attributes(info_add, os, 'os.%s', plain_attributes)
253+
254+
def format_set_of_functions(attr, value):
255+
return str(sorted(func.__name__ for func in value))
256+
257+
supports_attributes = (
258+
'supports_dir_fd',
258259
'supports_effective_ids',
259260
'supports_fd',
260261
'supports_follow_symlinks',
261262
)
262-
copy_attributes(info_add, os, 'os.%s', attributes, formatter=format_attr)
263+
copy_attributes(info_add, os, 'os.%s', supports_attributes,
264+
formatter=format_set_of_functions)
263265

264266
for func in (
265267
'cpu_count',

0 commit comments

Comments
 (0)