Expand Up @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-09-08 15:25+0800 \n" "POT-Creation-Date: 2025-12-09 00:14+0000 \n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" Expand Down Expand Up @@ -75,8 +75,8 @@ msgstr "" #: ../../c-api/gcsupport.rst:37 msgid "" "Before fields which refer to other containers are " "invalidated, :c:func: `PyObject_GC_UnTrack` must be called." "Before fields which refer to other containers areinvalidated, :c:func: " "`PyObject_GC_UnTrack` must be called." msgstr "" #: ../../c-api/gcsupport.rst:40 Expand All @@ -86,39 +86,39 @@ msgstr "" #: ../../c-api/gcsupport.rst:43 msgid "" "If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least " "a : c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from " "its subclass or subclasses." "If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at leasta : " "c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its " "subclass or subclasses." msgstr "" #: ../../c-api/gcsupport.rst:47 msgid "" "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " "it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " "interpreter will automatically populate " "the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` " "and :c:member: `~PyTypeObject.tp_clear` fields if the type inherits from a " "class that implements the garbage collector protocol and the child class " "does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." "interpreter will automatically populatethe :c:member:`~PyTypeObject. " "tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:" "`~PyTypeObject.tp_clear` fields if the type inherits from a class that " "implements the garbage collector protocol and the child class does *not* " "include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" #: ../../c-api/gcsupport.rst:57 msgid "" "Analogous to :c:macro:`PyObject_New` but for container objects with " "the :c: macro:`Py_TPFLAGS_HAVE_GC` flag set." "Analogous to :c:macro:`PyObject_New` but for container objects withthe :c: " "macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 msgid "" "Do not call this directly to allocate memory for an object; call the " "type's : c:member:`~PyTypeObject.tp_alloc` slot instead." "Do not call this directly to allocate memory for an object; call thetype's : " "c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 msgid "" "When populating a type's :c:member:`~PyTypeObject.tp_alloc` " "slot, :c:func: `PyType_GenericAlloc` is preferred over a custom function that " "simply calls this macro." "When populating a type's :c:member:`~PyTypeObject.tp_alloc`slot, :c:func: " "`PyType_GenericAlloc` is preferred over a custom function that simply calls " "this macro." msgstr "" #: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 Expand Down Expand Up @@ -146,8 +146,8 @@ msgstr ":c:member:`~PyTypeObject.tp_alloc`" #: ../../c-api/gcsupport.rst:81 msgid "" "Analogous to :c:macro:`PyObject_NewVar` but for container objects with " "the : c:macro:`Py_TPFLAGS_HAVE_GC` flag set." "Analogous to :c:macro:`PyObject_NewVar` but for container objects withthe : " "c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" #: ../../c-api/gcsupport.rst:98 Expand All @@ -170,17 +170,17 @@ msgstr "" #: ../../c-api/gcsupport.rst:114 msgid "" "Memory allocated by this function must be freed " "with :c:func: `PyObject_GC_Del` (usually called via the " "object's :c:member:`~PyTypeObject. tp_free` slot)." "Memory allocated by this function must be freedwith :c:func: " "`PyObject_GC_Del` (usually called via theobject's :c:member:`~PyTypeObject. " "tp_free` slot)." msgstr "" #: ../../c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " "number of fields, prefer using :c:type:`PyVarObject` " "and :c:member: `~PyTypeObject.tp_itemsize` instead." "number of fields, prefer using :c:type:`PyVarObject`and :c:member: " "`~PyTypeObject.tp_itemsize` instead." msgstr "" #: ../../c-api/gcsupport.rst:130 Expand Down Expand Up @@ -239,21 +239,21 @@ msgstr "" #: ../../c-api/gcsupport.rst:178 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_GC_New` " "or : c:macro:`PyObject_GC_NewVar`." "Releases memory allocated to an object using :c:macro:`PyObject_GC_New`or : " "c:macro:`PyObject_GC_NewVar`." msgstr "" #: ../../c-api/gcsupport.rst:181 msgid "" "Do not call this directly to free an object's memory; call the " "type's :c: member:`~PyTypeObject.tp_free` slot instead." "Do not call this directly to free an object's memory; call thetype's :c: " "member:`~PyTypeObject.tp_free` slot instead." msgstr "" #: ../../c-api/gcsupport.rst:184 msgid "" "Do not use this for memory allocated " "by :c:macro:`PyObject_New`, :c:macro:` PyObject_NewVar`, or related " "allocation functions; use :c:func: `PyObject_Free` instead." "Do not use this for memory allocatedby :c:macro:`PyObject_New`, :c:macro: " "` PyObject_NewVar`, or relatedallocation functions; use :c:func: " "`PyObject_Free` instead." msgstr "" #: ../../c-api/gcsupport.rst:190 Expand All @@ -276,10 +276,10 @@ msgstr ":c:member:`~PyTypeObject.tp_free`" msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " "this object to add it back to the set of tracked objects. The deallocator " "(: c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the " "object before any of the fields used by " "the :c:member:`~PyTypeObject.tp_traverse` handler become invalid." "this object to add it back to the set of tracked objects. The deallocator(: " "c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object " "before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` " "handler become invalid." msgstr "" #: ../../c-api/gcsupport.rst:208 Expand All @@ -296,12 +296,12 @@ msgstr "" #: ../../c-api/gcsupport.rst:216 msgid "" "Type of the visitor function passed to " "the :c:member:`~PyTypeObject. tp_traverse` handler. The function should be " "called with an object to traverse as *object* and the third parameter to " "the :c:member:`~PyTypeObject. tp_traverse` handler as *arg*. The Python core " "uses several visitor functions to implement cyclic garbage detection; it's " "not expected that users will need to write their own visitor functions." "Type of the visitor function passed tothe :c:member:`~PyTypeObject. " "tp_traverse` handler. The function should be called with an object to " "traverse as *object* and the third parameter tothe :c:member:`~PyTypeObject. " "tp_traverse` handler as *arg*. The Python core uses several visitor " "functions to implement cyclic garbage detection; it's not expected that " "users will need to write their own visitor functions." msgstr "" #: ../../c-api/gcsupport.rst:223 Expand All @@ -322,21 +322,28 @@ msgstr "" #: ../../c-api/gcsupport.rst:235 msgid "" "To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, " "a :c:func:`Py_VISIT` macro is provided. In order to use this macro, " "the :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg*:" "The traversal function must not have any side effects. Implementations may " "not modify the reference counts of any Python objects nor create or destroy " "any Python objects." msgstr "" #: ../../c-api/gcsupport.rst:239 msgid "" "To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" "func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" "member:`~PyTypeObject.tp_traverse` implementation must name its arguments " "exactly *visit* and *arg*:" msgstr "" #: ../../c-api/gcsupport.rst:242 #: ../../c-api/gcsupport.rst:246 msgid "" "If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " "with arguments *o* and *arg*. If *visit* returns a non-zero value, then " "return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers " "look like::" msgstr "" #: ../../c-api/gcsupport.rst:247 #: ../../c-api/gcsupport.rst:251 msgid "" "static int\n" "my_traverse(Noddy *self, visitproc visit, void *arg)\n" Expand All @@ -354,13 +361,13 @@ msgstr "" " return 0;\n" "}" #: ../../c-api/gcsupport.rst:255 #: ../../c-api/gcsupport.rst:259 msgid "" "The :c:member:`~PyTypeObject.tp_clear` handler must be of " "the :c:type: `inquiry` type, or ``NULL`` if the object is immutable." "The :c:member:`~PyTypeObject.tp_clear` handler must be ofthe :c:type: " "`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" #: ../../c-api/gcsupport.rst:261 #: ../../c-api/gcsupport.rst:265 msgid "" "Drop references that may have created reference cycles. Immutable objects " "do not have to define this method since they can never directly create " Expand All @@ -370,82 +377,82 @@ msgid "" "in a reference cycle." msgstr "" #: ../../c-api/gcsupport.rst:270 #: ../../c-api/gcsupport.rst:274 msgid "Controlling the Garbage Collector State" msgstr "" #: ../../c-api/gcsupport.rst:272 #: ../../c-api/gcsupport.rst:276 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" #: ../../c-api/gcsupport.rst:277 #: ../../c-api/gcsupport.rst:281 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" #: ../../c-api/gcsupport.rst:280 #: ../../c-api/gcsupport.rst:284 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " "returns ``0`` immediately. Errors during garbage collection are passed " "to : data:`sys.unraisablehook`. This function does not raise exceptions." "returns ``0`` immediately. Errors during garbage collection are passedto : " "data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" #: ../../c-api/gcsupport.rst:290 #: ../../c-api/gcsupport.rst:294 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" #: ../../c-api/gcsupport.rst:298 #: ../../c-api/gcsupport.rst:302 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" #: ../../c-api/gcsupport.rst:306 #: ../../c-api/gcsupport.rst:310 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" #: ../../c-api/gcsupport.rst:313 #: ../../c-api/gcsupport.rst:317 msgid "Querying Garbage Collector State" msgstr "" #: ../../c-api/gcsupport.rst:315 #: ../../c-api/gcsupport.rst:319 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" #: ../../c-api/gcsupport.rst:320 #: ../../c-api/gcsupport.rst:324 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" #: ../../c-api/gcsupport.rst:324 #: ../../c-api/gcsupport.rst:328 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" #: ../../c-api/gcsupport.rst:327 #: ../../c-api/gcsupport.rst:331 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" #: ../../c-api/gcsupport.rst:335 #: ../../c-api/gcsupport.rst:339 msgid "" "Type of the visitor function to be passed " "to :c:func: `PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* " "passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue " "iteration, return ``0`` to stop iteration. Other return values are reserved " "for now so behavior on returning anything else is undefined." "Type of the visitor function to be passedto :c:func: " "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " "``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " "``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr ""