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

Function get_build_info

Lib/test/libregrtest/utils.py:317–420  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

315
316
317def get_build_info():
318 # Get most important configure and build options as a list of strings.
319 # Example: ['debug', 'ASAN+MSAN'] or ['release', 'LTO+PGO'].
320
321 config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
322 cflags = sysconfig.get_config_var('PY_CFLAGS') or ''
323 cflags += ' ' + (sysconfig.get_config_var('PY_CFLAGS_NODIST') or '')
324 ldflags_nodist = sysconfig.get_config_var('PY_LDFLAGS_NODIST') or ''
325
326 build = []
327
328 # --disable-gil
329 if sysconfig.get_config_var('Py_GIL_DISABLED'):
330 if not sys.flags.ignore_environment:
331 PYTHON_GIL = os.environ.get('PYTHON_GIL', None)
332 if PYTHON_GIL:
333 PYTHON_GIL = (PYTHON_GIL == '1')
334 else:
335 PYTHON_GIL = None
336
337 free_threading = "free_threading"
338 if PYTHON_GIL is not None:
339 free_threading = f"{free_threading} GIL={int(PYTHON_GIL)}"
340 build.append(free_threading)
341
342 if hasattr(sys, 'gettotalrefcount'):
343 # --with-pydebug
344 build.append('debug')
345
346 if '-DNDEBUG' in cflags:
347 build.append('without_assert')
348 else:
349 build.append('release')
350
351 if '--with-assertions' in config_args:
352 build.append('with_assert')
353 elif '-DNDEBUG' not in cflags:
354 build.append('with_assert')
355
356 # --enable-experimental-jit
357 if sys._jit.is_available():
358 if sys._jit.is_enabled():
359 build.append("JIT")
360 else:
361 build.append("JIT (disabled)")
362
363 # --enable-framework=name
364 framework = sysconfig.get_config_var('PYTHONFRAMEWORK')
365 if framework:
366 build.append(f'framework={framework}')
367
368 # --enable-shared
369 shared = int(sysconfig.get_config_var('PY_ENABLE_SHARED') or '0')
370 if shared:
371 build.append('shared')
372
373 # --with-lto
374 optimizations = []

Callers 1

display_headerFunction · 0.85

Calls 3

getMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…