https://github.com/python/cpython/commit/c35ca4cb6e296d1770fe45f9414b58eb06242e02
commit: c35ca4cb6e296d1770fe45f9414b58eb06242e02
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: Yhg1s <[email protected]>
date: 2026-10-09T11:22:34Z
summary:

[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 eb77b4b2e4180b779e3d4c7d42c6a47ba965f74b)

Co-authored-by: Petr Viktorin <[email protected]>

files:
M Lib/test/pythoninfo.py

diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index 8af7f8b6ce6164f..e6b6271763d9a30 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -245,21 +245,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',

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to