Python Initialization Configuration — Python 3.11.16 documentation

docs.python.org

Tin mới

Initialization, Finalization, and Threads

Python Module Index

3.11.16 Documentation

Python/C API Reference Manual

default memory allocators

PYMEM_ALLOCATOR_DEFAULT (1): default memory allocators.

configured using --without-pymalloc

PYMEM_ALLOCATOR_NOT_SET (0): don’t change memory allocators (use defaults).

Python Development Mode

PYTHONLEGACYWINDOWSFSENCODING

Initialized the from PYTHONLEGACYWINDOWSFSENCODING environment variable value.

Preinitialize Python with PyPreConfig¶

Set the Python memory allocators (PyPreConfig.allocator)

Preinitialize Python with PyPreConfig¶

Set the Python memory allocators (PyPreConfig.allocator)

sys.base_exec_prefix

Opt-in EncodingWarning

If non-zero, emit a EncodingWarning warning when io.TextIOWrapper uses its default encoding. See Opt-in EncodingWarning for details.

faulthandler.enable()

If non-zero, call faulthandler.enable() at startup.

Filesystem encoding

On macOS, Android and VxWorks: use "utf-8" by default.

readline: GNU readline support for Python. (Unix)

Python REPL doesn’t import readline nor enable default readline configuration on interactive prompts.

site: Module responsible for site-specific configuration.

If equal to zero, disable the import of the module site and the site-dependent manipulations of sys.path that it entails.

tracemalloc.start()

Set by -X tracemalloc=N command line option and by the PYTHONTRACEMALLOC environment variable.

warnings: Issue warning messages and control their disposition.

Options of the warnings module to build warnings filters, lowest to highest priority: sys.warnoptions.

PyImport_FrozenModules()

The caller is responsible to handle exceptions (error or exit) using PyStatus_Exception() and Py_ExitStatusException().

Python Path Configuration¶

PyConfig contains multiple fields for the path configuration:

importlib: The implementation of the import machinery.