# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-08-22 12:07+0200\n" "PO-Revision-Date: 2025-09-16 00:00+0000\n" "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../../howto/free-threading-python.rst:5 msgid "Python support for free threading" msgstr "" #: ../../howto/free-threading-python.rst:7 msgid "" "Starting with the 3.13 release, CPython has support for a build of Python " "called :term:`free threading` where the :term:`global interpreter lock` " "(GIL) is disabled. Free-threaded execution allows for full utilization of " "the available processing power by running threads in parallel on available " "CPU cores. While not all software will benefit from this automatically, " "programs designed with threading in mind will run faster on multi-core " "hardware." msgstr "" #: ../../howto/free-threading-python.rst:14 msgid "" "Some third-party packages, in particular ones with an :term:`extension " "module`, may not be ready for use in a free-threaded build, and will re-" "enable the :term:`GIL`." msgstr "" #: ../../howto/free-threading-python.rst:18 msgid "" "This document describes the implications of free threading for Python code. " "See :ref:`freethreading-extensions-howto` for information on how to write C " "extensions that support the free-threaded build." msgstr "" #: ../../howto/free-threading-python.rst:24 msgid "" ":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " "overall description of free-threaded Python." msgstr "" #: ../../howto/free-threading-python.rst:29 msgid "Installation" msgstr "" #: ../../howto/free-threading-python.rst:31 msgid "" "Starting with Python 3.13, the official macOS and Windows installers " "optionally support installing free-threaded Python binaries. The installers " "are available at https://www.python.org/downloads/." msgstr "" #: ../../howto/free-threading-python.rst:35 msgid "" "For information on other platforms, see the `Installing a Free-Threaded " "Python `_, a " "community-maintained installation guide for installing free-threaded Python." msgstr "" #: ../../howto/free-threading-python.rst:39 msgid "" "When building CPython from source, the :option:`--disable-gil` configure " "option should be used to build a free-threaded Python interpreter." msgstr "" #: ../../howto/free-threading-python.rst:44 msgid "Identifying free-threaded Python" msgstr "" #: ../../howto/free-threading-python.rst:46 msgid "" "To check if the current interpreter supports free-threading, :option:`python " "-VV <-V>` and :data:`sys.version` contain \"free-threading build\". The new :" "func:`sys._is_gil_enabled` function can be used to check whether the GIL is " "actually disabled in the running process." msgstr "" #: ../../howto/free-threading-python.rst:51 msgid "" "The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " "can be used to determine whether the build supports free threading. If the " "variable is set to ``1``, then the build supports free threading. This is " "the recommended mechanism for decisions related to the build configuration." msgstr "" #: ../../howto/free-threading-python.rst:58 msgid "The global interpreter lock in free-threaded Python" msgstr "" #: ../../howto/free-threading-python.rst:60 msgid "" "Free-threaded builds of CPython support optionally running with the GIL " "enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " "the command-line option :option:`-X gil`." msgstr "" #: ../../howto/free-threading-python.rst:64 msgid "" "The GIL may also automatically be enabled when importing a C-API extension " "module that is not explicitly marked as supporting free threading. A " "warning will be printed in this case." msgstr "" #: ../../howto/free-threading-python.rst:68 msgid "" "In addition to individual package documentation, the following websites " "track the status of popular packages support for free threading:" msgstr "" #: ../../howto/free-threading-python.rst:71 msgid "https://py-free-threading.github.io/tracking/" msgstr "" #: ../../howto/free-threading-python.rst:72 msgid "https://hugovk.github.io/free-threaded-wheels/" msgstr "" #: ../../howto/free-threading-python.rst:76 msgid "Thread safety" msgstr "" #: ../../howto/free-threading-python.rst:78 msgid "" "The free-threaded build of CPython aims to provide similar thread-safety " "behavior at the Python level to the default GIL-enabled build. Built-in " "types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " "to protect against concurrent modifications in ways that behave similarly to " "the GIL. However, Python has not historically guaranteed specific behavior " "for concurrent modifications to these built-in types, so this should be " "treated as a description of the current implementation, not a guarantee of " "current or future behavior." msgstr "" #: ../../howto/free-threading-python.rst:89 msgid "" "It's recommended to use the :class:`threading.Lock` or other synchronization " "primitives instead of relying on the internal locks of built-in types, when " "possible." msgstr "" #: ../../howto/free-threading-python.rst:95 msgid "Known limitations" msgstr "" #: ../../howto/free-threading-python.rst:97 msgid "" "This section describes known limitations of the free-threaded CPython build." msgstr "" #: ../../howto/free-threading-python.rst:100 msgid "Immortalization" msgstr "" #: ../../howto/free-threading-python.rst:102 msgid "" "In the free-threaded build, some objects are :term:`immortal`. Immortal " "objects are not deallocated and have reference counts that are never " "modified. This is done to avoid reference count contention that would " "prevent efficient multi-threaded scaling." msgstr "" #: ../../howto/free-threading-python.rst:107 msgid "As of the 3.14 release, immortalization is limited to:" msgstr "" #: ../../howto/free-threading-python.rst:109 msgid "" "Code constants: numeric literals, string literals, and tuple literals " "composed of other constants." msgstr "" #: ../../howto/free-threading-python.rst:111 msgid "Strings interned by :func:`sys.intern`." msgstr "" #: ../../howto/free-threading-python.rst:115 msgid "Frame objects" msgstr "" #: ../../howto/free-threading-python.rst:117 msgid "" "It is not safe to access :attr:`frame.f_locals` from a :ref:`frame ` object if that frame is currently executing in another thread, and " "doing so may crash the interpreter." msgstr "" #: ../../howto/free-threading-python.rst:123 msgid "Iterators" msgstr "" #: ../../howto/free-threading-python.rst:125 msgid "" "It is generally not thread-safe to access the same iterator object from " "multiple threads concurrently, and threads may see duplicate or missing " "elements." msgstr "" #: ../../howto/free-threading-python.rst:131 msgid "Single-threaded performance" msgstr "" #: ../../howto/free-threading-python.rst:133 msgid "" "The free-threaded build has additional overhead when executing Python code " "compared to the default GIL-enabled build. The amount of overhead depends " "on the workload and hardware. On the pyperformance benchmark suite, the " "average overhead ranges from about 1% on macOS aarch64 to 8% on x86-64 Linux " "systems." msgstr "" #: ../../howto/free-threading-python.rst:141 msgid "Behavioral changes" msgstr "" #: ../../howto/free-threading-python.rst:143 msgid "" "This section describes CPython behavioural changes with the free-threaded " "build." msgstr "" #: ../../howto/free-threading-python.rst:148 msgid "Context variables" msgstr "" #: ../../howto/free-threading-python.rst:150 msgid "" "In the free-threaded build, the flag :data:`~sys.flags." "thread_inherit_context` is set to true by default which causes threads " "created with :class:`threading.Thread` to start with a copy of the :class:" "`~contextvars.Context()` of the caller of :meth:`~threading.Thread.start`. " "In the default GIL-enabled build, the flag defaults to false so threads " "start with an empty :class:`~contextvars.Context()`." msgstr "" #: ../../howto/free-threading-python.rst:160 msgid "Warning filters" msgstr "" #: ../../howto/free-threading-python.rst:162 msgid "" "In the free-threaded build, the flag :data:`~sys.flags." "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 :" "class:`warnings.catch_warnings` context manager uses a context variable for " "warning filters. If the flag is false then :class:`~warnings." "catch_warnings` modifies the global filters list, which is not thread-safe. " "See the :mod:`warnings` module for more details." msgstr "" #: ../../howto/free-threading-python.rst:171 msgid "Increased memory usage" msgstr "" #: ../../howto/free-threading-python.rst:173 msgid "" "The free-threaded build will typically use more memory compared to the " "default build. There are multiple reasons for this, mostly due to design " "decisions." msgstr "" #: ../../howto/free-threading-python.rst:178 msgid "All interned strings are immortal" msgstr "" #: ../../howto/free-threading-python.rst:180 msgid "" "For modern Python versions (since version 2.3), interning a string (e.g. " "with :func:`sys.intern`) does not cause it to become immortal. Instead, if " "the last reference to that string disappears, it will be removed from the " "interned string table. This is not the case for the free-threaded build and " "any interned string will become immortal, surviving until interpreter " "shutdown." msgstr "" #: ../../howto/free-threading-python.rst:188 msgid "Non-GC objects have a larger object header" msgstr "" #: ../../howto/free-threading-python.rst:190 msgid "" "The free-threaded build uses a different :c:type:`PyObject` structure. " "Instead of having the GC related information allocated before the :c:type:" "`PyObject` structure, like in the default build, the GC related info is part " "of the normal object header. For example, on the AMD64 platform, ``None`` " "uses 32 bytes on the free-threaded build vs 16 bytes for the default build. " "GC objects (such as dicts and lists) are the same size for both builds since " "the free-threaded build does not use additional space for the GC info." msgstr "" #: ../../howto/free-threading-python.rst:200 msgid "QSBR can delay freeing of memory" msgstr "" #: ../../howto/free-threading-python.rst:202 msgid "" "In order to safely implement lock-free data structures, a safe memory " "reclamation (SMR) scheme is used, known as quiescent state-based reclamation " "(QSBR). This means that the memory backing data structures allowing lock-" "free access will use QSBR, which defers the free operation, rather than " "immediately freeing the memory. Two examples of these data structures are " "the list object and the dictionary keys object. See ``InternalDocs/qsbr." "md`` in the CPython source tree for more details on how QSBR is " "implemented. Running :func:`gc.collect` should cause all memory being held " "by QSBR to be actually freed. Note that even when QSBR frees the memory, " "the underlying memory allocator may not immediately return that memory to " "the OS and so the resident set size (RSS) of the process might not decrease." msgstr "" #: ../../howto/free-threading-python.rst:216 msgid "mimalloc allocator vs pymalloc" msgstr "" #: ../../howto/free-threading-python.rst:218 msgid "" "The default build will normally use the \"pymalloc\" memory allocator for " "small allocations (512 bytes or smaller). The free-threaded build does not " "use pymalloc and allocates all Python objects using the \"mimalloc\" " "allocator. The pymalloc allocator has the following properties that help " "keep memory usage low: small per-allocated-block overhead, effective memory " "fragmentation prevention, and quick return of free memory to the operating " "system. The mimalloc allocator does quite well in these respects as well " "but can have some more overhead." msgstr "" #: ../../howto/free-threading-python.rst:227 msgid "" "In the free-threaded build, mimalloc manages memory in a number of separate " "heaps (currently four). For example, all GC supporting objects are " "allocated from their own heap. Using separate heaps means that free memory " "in one heap cannot be used for an allocation that uses another heap. Also, " "some heaps are configured to use QSBR (quiescent-state based reclamation) " "when freeing the memory that backs up the heap (known as \"pages\" in " "mimalloc terminology). The use of QSBR creates a delay between all memory " "blocks for a page being freed and the memory page being released, either for " "new allocations or back to the OS." msgstr "" #: ../../howto/free-threading-python.rst:237 msgid "" "The mimalloc allocator also defers returning freed memory back to the OS. " "You can reduce that delay by setting the environment variable :envvar:`!" "MIMALLOC_PURGE_DELAY` to ``0``. Note that this will likely reduce the " "performance of the allocator." msgstr "" #: ../../howto/free-threading-python.rst:244 msgid "Free-threaded reference counting can cause objects to live longer" msgstr "" #: ../../howto/free-threading-python.rst:246 msgid "" "In the default build, when an object's reference count reaches zero, it is " "normally deallocated. The free-threaded build uses \"biased reference " "counting\", with a fast-path for objects \"owned\" by the current thread and " "a slow path for other objects. See :pep:`703` for additional details. Any " "time an object's reference count ends up in a \"queued\" state, deallocation " "can be deferred. The queued state is cleared from the \"eval breaker\" " "section of the bytecode evaluator." msgstr "" #: ../../howto/free-threading-python.rst:254 msgid "" "The free-threaded build also allows a different mode of reference counting, " "known as \"deferred reference counting\". This mode is enabled by setting a " "flag on a per-object basis. Deferred reference counting is enabled for the " "following types:" msgstr "" #: ../../howto/free-threading-python.rst:259 msgid "module objects" msgstr "" #: ../../howto/free-threading-python.rst:260 msgid "module top-level functions" msgstr "" #: ../../howto/free-threading-python.rst:261 msgid "class methods defined in the class scope" msgstr "" #: ../../howto/free-threading-python.rst:262 msgid "descriptor objects" msgstr "" #: ../../howto/free-threading-python.rst:263 msgid "thread-local objects, created by :class:`threading.local`" msgstr "" #: ../../howto/free-threading-python.rst:265 msgid "" "When deferred reference counting is enabled, references from Python function " "stacks are not added to the reference count. This scheme reduces the " "overhead of reference counting, especially for objects used from multiple " "threads. Because the stack references are not counted, objects with deferred " "reference counting are not immediately freed when their internal reference " "count goes to zero. Instead, they are examined by the next GC run and, if " "no stack references to them are found, they are freed. This means these " "objects are freed by the GC and not when their reference count goes to zero, " "as is typical." msgstr "" #: ../../howto/free-threading-python.rst:276 msgid "Per-thread reference counting can delay freeing objects" msgstr "" #: ../../howto/free-threading-python.rst:278 msgid "" "To avoid contention on the reference count fields of frequently shared " "objects, the free-threaded build also uses \"per-thread reference counting\" " "for a few selected object types. Rather than updating a single shared " "reference count, each thread maintains its own local reference count array, " "indexed by a unique id assigned to the object. The true reference count is " "only computed by summing the per-thread counts when the object's local count " "drops to zero. Per-thread reference counting is currently used for:" msgstr "" #: ../../howto/free-threading-python.rst:286 msgid "heap type objects (classes created in Python)" msgstr "" #: ../../howto/free-threading-python.rst:287 msgid "code objects" msgstr "" #: ../../howto/free-threading-python.rst:288 msgid "the ``__dict__`` of module objects" msgstr "" #: ../../howto/free-threading-python.rst:290 msgid "" "Because the per-thread counts must be merged back to the object before it " "can be deallocated, objects using per-thread reference counting are " "typically freed later than they would be in the default build. In " "particular, such an object is usually not freed until the thread that " "referenced it reaches a safe point (for example, in the \"eval breaker\" " "section of the bytecode evaluator) or exits. Running :func:`gc.collect` " "will merge the per-thread counts and allow these objects to be freed." msgstr ""