@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.12\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2023-10-20 14:13 +0000\n "
14+ "POT-Creation-Date : 2023-11-17 14:14 +0000\n "
1515"PO-Revision-Date : 2022-11-05 19:48+0000\n "
1616"
Last-Translator :
Maciej Olko <[email protected] >, 2022\n "
1717"Language-Team : Polish (https://app.transifex.com/python-doc/teams/5390/pl/)\n "
@@ -384,15 +384,46 @@ msgid ""
384384msgstr ""
385385
386386msgid ""
387- "Please refer to the :ref:`the documentation <type-structs>` of :c:macro:"
388- "`Py_TPFLAGS_HAVE_GC` and :c:member:`~PyTypeObject.tp_traverse` for "
389- "additional considerations."
387+ "Please refer to the the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :"
388+ "c:member:`~PyTypeObject.tp_traverse` for additional considerations."
390389msgstr ""
391390
392391msgid ""
393- "If your traverse function delegates to the ``tp_traverse`` of its base class "
394- "(or another type), ensure that ``Py_TYPE(self)`` is visited only once. Note "
395- "that only heap type are expected to visit the type in ``tp_traverse``."
392+ "The API for defining heap types grew organically, leaving it somewhat "
393+ "awkward to use in its current state. The following sections will guide you "
394+ "through common issues."
395+ msgstr ""
396+
397+ msgid "``tp_traverse`` in Python 3.8 and lower"
398+ msgstr ""
399+
400+ msgid ""
401+ "The requirement to visit the type from ``tp_traverse`` was added in Python "
402+ "3.9. If you support Python 3.8 and lower, the traverse function must *not* "
403+ "visit the type, so it must be more complicated::"
404+ msgstr ""
405+
406+ msgid ""
407+ "Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a "
408+ "replacement, use:"
409+ msgstr ""
410+
411+ msgid ":c:macro:`PY_VERSION_HEX`, if not using the stable ABI, or"
412+ msgstr ""
413+
414+ msgid ""
415+ ":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` and :c:func:"
416+ "`PyArg_ParseTuple`)."
417+ msgstr ""
418+
419+ msgid "Delegating ``tp_traverse``"
420+ msgstr ""
421+
422+ msgid ""
423+ "If your traverse function delegates to the :c:member:`~PyTypeObject."
424+ "tp_traverse` of its base class (or another type), ensure that "
425+ "``Py_TYPE(self)`` is visited only once. Note that only heap type are "
426+ "expected to visit the type in ``tp_traverse``."
396427msgstr ""
397428
398429msgid "For example, if your traverse function includes::"
@@ -402,8 +433,65 @@ msgid "...and ``base`` may be a static type, then it should also include::"
402433msgstr ""
403434
404435msgid ""
405- "It is not necessary to handle the type's reference count in ``tp_new`` and "
406- "``tp_clear``."
436+ "It is not necessary to handle the type's reference count in :c:member:"
437+ "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`."
438+ msgstr ""
439+
440+ msgid "Defining ``tp_dealloc``"
441+ msgstr ""
442+
443+ msgid ""
444+ "If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it "
445+ "needs to:"
446+ msgstr ""
447+
448+ msgid ""
449+ "call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and"
450+ msgstr ""
451+
452+ msgid "decrement the reference count of the type."
453+ msgstr ""
454+
455+ msgid ""
456+ "To keep the type valid while ``tp_free`` is called, the type's refcount "
457+ "needs to be decremented *after* the instance is deallocated. For example::"
458+ msgstr ""
459+
460+ msgid ""
461+ "The default ``tp_dealloc`` function does this, so if your type does *not* "
462+ "override ``tp_dealloc`` you don't need to add it."
463+ msgstr ""
464+
465+ msgid "Not overriding ``tp_free``"
466+ msgstr ""
467+
468+ msgid ""
469+ "The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set to :c:"
470+ "func:`PyObject_GC_Del`. This is the default; do not override it."
471+ msgstr ""
472+
473+ msgid "Avoiding ``PyObject_New``"
474+ msgstr ""
475+
476+ msgid "GC-tracked objects need to be allocated using GC-aware functions."
477+ msgstr ""
478+
479+ msgid "If you use use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:"
480+ msgstr ""
481+
482+ msgid ""
483+ "Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. "
484+ "That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::"
485+ msgstr ""
486+
487+ msgid ""
488+ "Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use "
489+ "size instead of the 0."
490+ msgstr ""
491+
492+ msgid ""
493+ "If the above is not possible (e.g. inside a custom ``tp_alloc``), call :c:"
494+ "func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::"
407495msgstr ""
408496
409497msgid "Module State Access from Classes"
0 commit comments