@@ -151,6 +151,11 @@ def collect_locale(info_add):
151151 info_add ('locale.encoding' , locale .getpreferredencoding (False ))
152152
153153
154+ def collect_builtins (info_add ):
155+ info_add ('builtins.float.float_format' , float .__getformat__ ("float" ))
156+ info_add ('builtins.float.double_format' , float .__getformat__ ("double" ))
157+
158+
154159def collect_os (info_add ):
155160 import os
156161
@@ -170,7 +175,7 @@ def format_attr(attr, value):
170175 )
171176 copy_attributes (info_add , os , 'os.%s' , attributes , formatter = format_attr )
172177
173- info_add ( " os.cwd" , os . getcwd () )
178+ call_func ( info_add , ' os.cwd' , os , ' getcwd' )
174179
175180 call_func (info_add , 'os.uid' , os , 'getuid' )
176181 call_func (info_add , 'os.gid' , os , 'getgid' )
@@ -435,6 +440,44 @@ def collect_testcapi(info_add):
435440 copy_attr (info_add , 'pymem.with_pymalloc' , _testcapi , 'WITH_PYMALLOC' )
436441
437442
443+ def collect_resource (info_add ):
444+ try :
445+ import resource
446+ except ImportError :
447+ return
448+
449+ limits = [attr for attr in dir (resource ) if attr .startswith ('RLIMIT_' )]
450+ for name in limits :
451+ key = getattr (resource , name )
452+ value = resource .getrlimit (key )
453+ info_add ('resource.%s' % name , value )
454+
455+
456+ def collect_test_socket (info_add ):
457+ try :
458+ from test import test_socket
459+ except ImportError :
460+ return
461+
462+ # all check attributes like HAVE_SOCKET_CAN
463+ attributes = [name for name in dir (test_socket )
464+ if name .startswith ('HAVE_' )]
465+ copy_attributes (info_add , test_socket , 'test_socket.%s' , attributes )
466+
467+
468+ def collect_test_support (info_add ):
469+ try :
470+ from test import support
471+ except ImportError :
472+ return
473+
474+ attributes = ('IPV6_ENABLED' ,)
475+ copy_attributes (info_add , support , 'test_support.%s' , attributes )
476+
477+ call_func (info_add , 'test_support._is_gui_available' , support , '_is_gui_available' )
478+ call_func (info_add , 'test_support.python_is_optimized' , support , 'python_is_optimized' )
479+
480+
438481def collect_info (info ):
439482 error = False
440483 info_add = info .add
@@ -443,6 +486,7 @@ def collect_info(info):
443486 # collect_os() should be the first, to check the getrandom() status
444487 collect_os ,
445488
489+ collect_builtins ,
446490 collect_gdb ,
447491 collect_locale ,
448492 collect_platform ,
@@ -458,6 +502,11 @@ def collect_info(info):
458502 collect_expat ,
459503 collect_decimal ,
460504 collect_testcapi ,
505+ collect_resource ,
506+
507+ # Collecting from tests should be last as they have side effects.
508+ collect_test_socket ,
509+ collect_test_support ,
461510 ):
462511 try :
463512 collect_func (info_add )
0 commit comments