MCPcopy Index your code
hub / github.com/python/cpython / collect_sys

Function collect_sys

Lib/test/pythoninfo.py:78–149  ·  view source on GitHub ↗
(info_add)

Source from the content-addressed store, hash-verified

76
77
78def collect_sys(info_add):
79 attributes = (
80 '_emscripten_info',
81 '_framework',
82 'abiflags',
83 'api_version',
84 'builtin_module_names',
85 'byteorder',
86 'dont_write_bytecode',
87 'executable',
88 'flags',
89 'float_info',
90 'float_repr_style',
91 'hash_info',
92 'hexversion',
93 'implementation',
94 'int_info',
95 'maxsize',
96 'maxunicode',
97 'path',
98 'platform',
99 'platlibdir',
100 'prefix',
101 'thread_info',
102 'version',
103 'version_info',
104 'winver',
105 )
106 copy_attributes(info_add, sys, 'sys.%s', attributes)
107
108 for func in (
109 '_is_gil_enabled',
110 'getandroidapilevel',
111 'getrecursionlimit',
112 'getwindowsversion',
113 ):
114 call_func(info_add, f'sys.{func}', sys, func)
115
116 encoding = sys.getfilesystemencoding()
117 if hasattr(sys, 'getfilesystemencodeerrors'):
118 encoding = '%s/%s' % (encoding, sys.getfilesystemencodeerrors())
119 info_add('sys.filesystem_encoding', encoding)
120
121 for name in ('stdin', 'stdout', 'stderr'):
122 stream = getattr(sys, name)
123 if stream is None:
124 continue
125 encoding = getattr(stream, 'encoding', None)
126 if not encoding:
127 continue
128 errors = getattr(stream, 'errors', None)
129 if errors:
130 encoding = '%s/%s' % (encoding, errors)
131 info_add('sys.%s.encoding' % name, encoding)
132
133 # Were we compiled --with-pydebug?
134 Py_DEBUG = hasattr(sys, 'gettotalrefcount')
135 if Py_DEBUG:

Callers

nothing calls this directly

Calls 2

copy_attributesFunction · 0.85
call_funcFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…