Tin mới
Thread states and the global interpreter lock
Python Initialization Configuration
See Python Initialization Configuration for details on how to configure the interpreter prior to initialization.
Python has variables for the global configuration to control different features and options. By default, these flags are controlled by command line options.
filesystem encoding and error handler
This API is kept for backward compatibility: setting PyPreConfig.legacy_windows_fs_encoding should be used instead, see Python Initialization Configuration.
sys: Access system-specific parameters and functions.
This API is kept for backward compatibility: setting PyConfig.legacy_windows_stdio should be used instead, see Python Initialization Configuration.
site: Module responsible for site-specific configuration.
This API is kept for backward compatibility: setting PyConfig.site_import should be used instead, see Python Initialization Configuration.
builtins: The module that provides the built-in namespace.
Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; see Before Python Initialization for the few exceptions.
Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; see Before Python Initialization for the few exceptions.
Undo all initializations made by Py_Initialize() and subsequent use of Python/C API functions, and destroy all sub-interpreters (see Py_NewInterpreter() below) that were created and not yet destroyed since the last call
atexit: Register and execute cleanup functions.
Undo all initializations made by Py_Initialize() and subsequent use of Python/C API functions, and destroy all sub-interpreters (see Py_NewInterpreter() below) that were created and not yet destroyed since the last call
Cautions regarding interpreter finalization¶
Prior to CPython 3.13, the thread would exit instead of hanging, which led to other issues (see the warning note at PyThread_exit_thread()).