@@ -12,7 +12,7 @@ msgid ""
1212msgstr ""
1313"Project-Id-Version : Python 3.9\n "
1414"Report-Msgid-Bugs-To : \n "
15- "POT-Creation-Date : 2021-01-01 05:02 +0000\n "
15+ "POT-Creation-Date : 2021-05-29 06:28 +0000\n "
1616"PO-Revision-Date : 2017-02-16 17:35+0000\n "
1717"
Last-Translator :
Freesand Leo <[email protected] >, 2020\n "
1818"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -74,21 +74,39 @@ msgid ""
7474"initialized, it must call :c:func:`PyObject_GC_Track`."
7575msgstr "初始化了所有可能包含其他容器的引用的字段后,它必须调用 :c:func:`PyObject_GC_Track` 。"
7676
77- #: ../../c-api/gcsupport.rst:39
77+ #: ../../c-api/gcsupport.rst:37
78+ msgid ""
79+ "If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a "
80+ ":c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its"
81+ " subclass or subclasses."
82+ msgstr ""
83+
84+ #: ../../c-api/gcsupport.rst:41
85+ msgid ""
86+ "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call"
87+ " it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the"
88+ " interpreter will automatically populate the "
89+ ":c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` "
90+ "and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a "
91+ "class that implements the garbage collector protocol and the child class "
92+ "does *not* include the :const:`Py_TPFLAGS_HAVE_GC` flag."
93+ msgstr ""
94+
95+ #: ../../c-api/gcsupport.rst:51
7896msgid ""
7997"Analogous to :c:func:`PyObject_New` but for container objects with the "
8098":const:`Py_TPFLAGS_HAVE_GC` flag set."
8199msgstr ""
82100"类似于 :c:func:`PyObject_New` ,适用于设置了 :const:`Py_TPFLAGS_HAVE_GC` 标签的容器对象。"
83101
84- #: ../../c-api/gcsupport.rst:45
102+ #: ../../c-api/gcsupport.rst:57
85103msgid ""
86104"Analogous to :c:func:`PyObject_NewVar` but for container objects with the "
87105":const:`Py_TPFLAGS_HAVE_GC` flag set."
88106msgstr ""
89107"类似于 :c:func:`PyObject_NewVar` ,适用于设置了 :const:`Py_TPFLAGS_HAVE_GC` 标签的容器对象。"
90108
91- #: ../../c-api/gcsupport.rst:51
109+ #: ../../c-api/gcsupport.rst:63
92110msgid ""
93111"Resize an object allocated by :c:func:`PyObject_NewVar`. Returns the "
94112"resized object or ``NULL`` on failure. *op* must not be tracked by the "
@@ -97,7 +115,7 @@ msgstr ""
97115"为 :c:func:`PyObject_NewVar` 所分配对象重新调整大小。 返回调整大小后的对象或在失败时返回 ``NULL``。 *op* "
98116"必须尚未被垃圾回收器追踪。"
99117
100- #: ../../c-api/gcsupport.rst:57
118+ #: ../../c-api/gcsupport.rst:69
101119msgid ""
102120"Adds the object *op* to the set of container objects tracked by the "
103121"collector. The collector can run at unexpected times so objects must be "
@@ -108,64 +126,64 @@ msgstr ""
108126"把对象 *op* 加入到垃圾回收器跟踪的容器对象中。对象在被回收器跟踪时必须保持有效的,因为回收器可能在任何时候开始运行。在 "
109127":c:member:`~PyTypeObject.tp_traverse` 处理前的所有字段变为有效后,必须调用此函数,通常在靠近构造函数末尾的位置。"
110128
111- #: ../../c-api/gcsupport.rst:66
129+ #: ../../c-api/gcsupport.rst:78
112130msgid ""
113131"Returns non-zero if the object implements the garbage collector protocol, "
114132"otherwise returns 0."
115133msgstr "如果对象实现了垃圾回收器协议则返回非零值,否则返回 0。"
116134
117- #: ../../c-api/gcsupport.rst:69
135+ #: ../../c-api/gcsupport.rst:81
118136msgid ""
119137"The object cannot be tracked by the garbage collector if this function "
120138"returns 0."
121139msgstr "如果此函数返回 0 则对象无法被垃圾回收器追踪。"
122140
123- #: ../../c-api/gcsupport.rst:74
141+ #: ../../c-api/gcsupport.rst:86
124142msgid ""
125143"Returns 1 if the object type of *op* implements the GC protocol and *op* is "
126144"being currently tracked by the garbage collector and 0 otherwise."
127145msgstr "如果 *op* 对象的类型实现了 GC 协议且 *op* 目前正被垃圾回收器追踪则返回 1, 否则返回 0。"
128146
129- #: ../../c-api/gcsupport.rst:77
147+ #: ../../c-api/gcsupport.rst:89
130148msgid "This is analogous to the Python function :func:`gc.is_tracked`."
131149msgstr "这类似于 Python 函数 :func:`gc.is_tracked`。"
132150
133- #: ../../c-api/gcsupport.rst:84
151+ #: ../../c-api/gcsupport.rst:96
134152msgid ""
135153"Returns 1 if the object type of *op* implements the GC protocol and *op* has"
136154" been already finalized by the garbage collector and 0 otherwise."
137155msgstr "如果 *op* 对象的类型实现了 GC 协议且 *op* 已经被垃圾回收器终结则返回 1, 否则返回 0。"
138156
139- #: ../../c-api/gcsupport.rst:87
157+ #: ../../c-api/gcsupport.rst:99
140158msgid "This is analogous to the Python function :func:`gc.is_finalized`."
141159msgstr "这类似于 Python 函数 :func:`gc.is_finalized`。"
142160
143- #: ../../c-api/gcsupport.rst:91
161+ #: ../../c-api/gcsupport.rst:103
144162msgid ""
145163"Similarly, the deallocator for the object must conform to a similar pair of "
146164"rules:"
147165msgstr "同样的,对象的释放器必须符合两个类似的规则:"
148166
149- #: ../../c-api/gcsupport.rst:94
167+ #: ../../c-api/gcsupport.rst:106
150168msgid ""
151169"Before fields which refer to other containers are invalidated, "
152170":c:func:`PyObject_GC_UnTrack` must be called."
153171msgstr "在引用其它容器的字段失效前,必须调用 :c:func:`PyObject_GC_UnTrack` 。"
154172
155- #: ../../c-api/gcsupport.rst:97
173+ #: ../../c-api/gcsupport.rst:109
156174msgid ""
157175"The object's memory must be deallocated using :c:func:`PyObject_GC_Del`."
158176msgstr "必须使用 :c:func:`PyObject_GC_Del` 释放对象的内存。"
159177
160- #: ../../c-api/gcsupport.rst:102
178+ #: ../../c-api/gcsupport.rst:114
161179msgid ""
162180"Releases memory allocated to an object using :c:func:`PyObject_GC_New` or "
163181":c:func:`PyObject_GC_NewVar`."
164182msgstr ""
165183"释放对象的内存,该对象初始化时由 :c:func:`PyObject_GC_New` 或 :c:func:`PyObject_GC_NewVar` "
166184"分配内存。"
167185
168- #: ../../c-api/gcsupport.rst:108
186+ #: ../../c-api/gcsupport.rst:120
169187msgid ""
170188"Remove the object *op* from the set of container objects tracked by the "
171189"collector. Note that :c:func:`PyObject_GC_Track` can be called again on "
@@ -178,21 +196,21 @@ msgstr ""
178196"以将其加回到被跟踪对象集合。 释放器 (:c:member:`~PyTypeObject.tp_dealloc` 句柄) 应当在 "
179197":c:member:`~PyTypeObject.tp_traverse` 句柄所使用的任何字段失效之前为对象调用此函数。"
180198
181- #: ../../c-api/gcsupport.rst:117
199+ #: ../../c-api/gcsupport.rst:129
182200msgid ""
183201"The :c:func:`_PyObject_GC_TRACK` and :c:func:`_PyObject_GC_UNTRACK` macros "
184202"have been removed from the public C API."
185203msgstr ""
186204":c:func:`_PyObject_GC_TRACK` 和 :c:func:`_PyObject_GC_UNTRACK` 宏已从公有 C API "
187205"中移除。"
188206
189- #: ../../c-api/gcsupport.rst:120
207+ #: ../../c-api/gcsupport.rst:132
190208msgid ""
191209"The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function "
192210"parameter of this type:"
193211msgstr ":c:member:`~PyTypeObject.tp_traverse` 处理接收以下类型的函数形参。"
194212
195- #: ../../c-api/gcsupport.rst:125
213+ #: ../../c-api/gcsupport.rst:137
196214msgid ""
197215"Type of the visitor function passed to the "
198216":c:member:`~PyTypeObject.tp_traverse` handler. The function should be called"
@@ -205,13 +223,13 @@ msgstr ""
205223"是容器中需要被遍历的一个对象,第三个形参对应于 :c:member:`~PyTypeObject.tp_traverse` 处理的 *arg* "
206224"。Python核心使用多个访问者函数实现循环引用的垃圾检测,不需要用户自行实现访问者函数。"
207225
208- #: ../../c-api/gcsupport.rst:132
226+ #: ../../c-api/gcsupport.rst:144
209227msgid ""
210228"The :c:member:`~PyTypeObject.tp_traverse` handler must have the following "
211229"type:"
212230msgstr ":c:member:`~PyTypeObject.tp_traverse` 处理必须是以下类型:"
213231
214- #: ../../c-api/gcsupport.rst:137
232+ #: ../../c-api/gcsupport.rst:149
215233msgid ""
216234"Traversal function for a container object. Implementations must call the "
217235"*visit* function for each object directly contained by *self*, with the "
@@ -224,7 +242,7 @@ msgstr ""
224242"的形参为所包含对象和传给处理程序的 *arg* 值。 *visit* 函数调用不可附带 ``NULL`` 对象作为参数。 如果 *visit* "
225243"返回非零值,则该值应当被立即返回。"
226244
227- #: ../../c-api/gcsupport.rst:144
245+ #: ../../c-api/gcsupport.rst:156
228246msgid ""
229247"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a "
230248":c:func:`Py_VISIT` macro is provided. In order to use this macro, the "
@@ -235,7 +253,7 @@ msgstr ""
235253":c:func:`Py_VISIT` 宏。若要使用这个宏,必须把 :c:member:`~PyTypeObject.tp_traverse` "
236254"的参数命名为 *visit* 和 *arg* 。"
237255
238- #: ../../c-api/gcsupport.rst:151
256+ #: ../../c-api/gcsupport.rst:163
239257msgid ""
240258"If *o* is not ``NULL``, call the *visit* callback, with arguments *o* and "
241259"*arg*. If *visit* returns a non-zero value, then return it. Using this "
@@ -244,15 +262,15 @@ msgstr ""
244262"如果 *o* 不为 ``NULL``,则调用 *visit* 回调函数,附带参数 *o* 和 *arg*。 如果 *visit* "
245263"返回一个非零值,则返回该值。 使用此宏之后,:c:member:`~PyTypeObject.tp_traverse` 处理程序的形式如下::"
246264
247- #: ../../c-api/gcsupport.rst:164
265+ #: ../../c-api/gcsupport.rst:176
248266msgid ""
249267"The :c:member:`~PyTypeObject.tp_clear` handler must be of the "
250268":c:type:`inquiry` type, or ``NULL`` if the object is immutable."
251269msgstr ""
252270":c:member:`~PyTypeObject.tp_clear` 处理程序必须为 :c:type:`inquiry` 类型,如果对象不可变则为 "
253271"``NULL``。"
254272
255- #: ../../c-api/gcsupport.rst:170
273+ #: ../../c-api/gcsupport.rst:182
256274msgid ""
257275"Drop references that may have created reference cycles. Immutable objects "
258276"do not have to define this method since they can never directly create "
0 commit comments