Python support for free threading — Python 3.14.7 documentation

docs.python.org

Tin mới

The Python 2.3 Method Resolution Order

C API Extension Support for Free Threading

Python Module Index

3.14.7 Documentation

global interpreter lock

Some third-party packages, in particular ones with an extension module, may not be ready for use in a free-threaded build, and will re-enable the GIL.

Identifying free-threaded Python¶

To check if the current interpreter supports free-threading, python -VV and sys.version contain “free-threading build”. The new sys._is_gil_enabled() function can be used to check whether the GIL is actually disabled in

Identifying free-threaded Python¶

To check if the current interpreter supports free-threading, python -VV and sys.version contain “free-threading build”. The new sys._is_gil_enabled() function can be used to check whether the GIL is actually disabled in

Context variables¶

In the free-threaded build, the flag thread_inherit_context is set to true by default which causes threads created with threading.Thread to start with a copy of the Context() of the caller of start(). In the default GIL-

contextvars.Context

In the free-threaded build, the flag thread_inherit_context is set to true by default which causes threads created with threading.Thread to start with a copy of the Context() of the caller of start(). In the default GIL-

warnings.catch_warnings

In the free-threaded build, the flag context_aware_warnings is set to true by default. In the default GIL-enabled build, the flag defaults to false. If the flag is true then the warnings.catch_warnings context manager us

Non-GC objects have a larger object header¶

QSBR can delay freeing of memory¶