@@ -151,6 +151,11 @@ def collect_locale(info_add):
151
151
info_add ('locale.encoding' , locale .getpreferredencoding (False ))
152
152
153
153
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
+
154
159
def collect_os (info_add ):
155
160
import os
156
161
@@ -170,7 +175,7 @@ def format_attr(attr, value):
170
175
)
171
176
copy_attributes (info_add , os , 'os.%s' , attributes , formatter = format_attr )
172
177
173
- info_add ( " os.cwd" , os . getcwd () )
178
+ call_func ( info_add , ' os.cwd' , os , ' getcwd' )
174
179
175
180
call_func (info_add , 'os.uid' , os , 'getuid' )
176
181
call_func (info_add , 'os.gid' , os , 'getgid' )
@@ -435,6 +440,44 @@ def collect_testcapi(info_add):
435
440
copy_attr (info_add , 'pymem.with_pymalloc' , _testcapi , 'WITH_PYMALLOC' )
436
441
437
442
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
+
438
481
def collect_info (info ):
439
482
error = False
440
483
info_add = info .add
@@ -443,6 +486,7 @@ def collect_info(info):
443
486
# collect_os() should be the first, to check the getrandom() status
444
487
collect_os ,
445
488
489
+ collect_builtins ,
446
490
collect_gdb ,
447
491
collect_locale ,
448
492
collect_platform ,
@@ -458,6 +502,11 @@ def collect_info(info):
458
502
collect_expat ,
459
503
collect_decimal ,
460
504
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 ,
461
510
):
462
511
try :
463
512
collect_func (info_add )
0 commit comments