@@ -141,6 +141,9 @@ msgid ""
141141" in its flags then it **must** implement the GC protocol itself by at least "
142142"implementing the :c:member:`~PyTypeObject.tp_traverse` handle."
143143msgstr ""
144+ "如果某些基类实现了 GC 协议并且所提供的类型的旗标中未包括 :const:`Py_TPFLAGS_HAVE_GC`,则将自动从其父类实现 GC 协议。"
145+ " 相反地,如果被创建的类型的旗标中未包括 :const:`Py_TPFLAGS_HAVE_GC` 则它 **必须** 自己通过实现 "
146+ ":c:member:`~PyTypeObject.tp_traverse` 句柄来实现 GC 协议。"
144147
145148#: ../../c-api/type.rst:111
146149msgid ""
@@ -149,29 +152,32 @@ msgid ""
149152"function was called with invalid parameters. Callers will typically cast the"
150153" result pointer into the appropriate function type."
151154msgstr ""
155+ "返回存储在给定槽位中的函数指针。 如果结果为 ``NULL``,则表示或者该槽位为 ``NULL``,或者该函数调用传入了无效的形参。 "
156+ "调用方通常要将结果指针转换到适当的函数类型。"
152157
153158#: ../../c-api/type.rst:117
154159msgid ""
155160"See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument."
156- msgstr ""
161+ msgstr "请参阅 :c:member:`PyType_Slot.slot` 查看可用的 *slot* 参数值。 "
157162
158163#: ../../c-api/type.rst:121
159164msgid ""
160165":c:func:`PyType_GetSlot` can now accept all types. Previously, it was "
161166"limited to :ref:`heap types <heap-types>`."
162167msgstr ""
168+ ":c:func:`PyType_GetSlot` 现在可以接受所有类型。 在此之前,它被限制为 :ref:`堆类型 <heap-types>`。"
163169
164170#: ../../c-api/type.rst:127
165171msgid ""
166172"Return the module object associated with the given type when the type was "
167173"created using :c:func:`PyType_FromModuleAndSpec`."
168- msgstr ""
174+ msgstr "返回当使用 :c:func:`PyType_FromModuleAndSpec` 创建类型时关联到给定类型的模块对象。 "
169175
170176#: ../../c-api/type.rst:130 ../../c-api/type.rst:148
171177msgid ""
172178"If no module is associated with the given type, sets :py:class:`TypeError` "
173179"and returns ``NULL``."
174- msgstr ""
180+ msgstr "如果没有关联到给定类型的模块,则设置 :py:class:`TypeError` 并返回 ``NULL``。 "
175181
176182#: ../../c-api/type.rst:133
177183msgid ""
@@ -182,23 +188,28 @@ msgid ""
182188"module as their superclass. See :c:type:`PyCMethod` to get the class that "
183189"defines the method."
184190msgstr ""
191+ "此函数通常被用于获取方法定义所在的模块。 请注意在这样的方法中,``PyType_GetModule(Py_TYPE(self))`` "
192+ "可能不会返回预期的结果。 ``Py_TYPE(self)`` 可以是目标类的一个 *子类*,而子类并不一定是在与其上级类相同的模块中定义的。 请参阅 "
193+ ":c:type:`PyCMethod` 了解如何获取方法定义所在的类。"
185194
186195#: ../../c-api/type.rst:144
187196msgid ""
188197"Return the state of the module object associated with the given type. This "
189198"is a shortcut for calling :c:func:`PyModule_GetState()` on the result of "
190199":c:func:`PyType_GetModule`."
191200msgstr ""
201+ "返回关联到给定类型的模块对象的状态。 这是一个在 :c:func:`PyType_GetModule` 的结果上调用 "
202+ ":c:func:`PyModule_GetState()` 的快捷方式。"
192203
193204#: ../../c-api/type.rst:151
194205msgid ""
195206"If the *type* has an associated module but its state is ``NULL``, returns "
196207"``NULL`` without setting an exception."
197- msgstr ""
208+ msgstr "如果 *type* 有关联的模块但其状态为 ``NULL``,则返回 ``NULL`` 且不设置异常。 "
198209
199210#: ../../c-api/type.rst:158
200211msgid "Creating Heap-Allocated Types"
201- msgstr ""
212+ msgstr "创建堆分配类型 "
202213
203214#: ../../c-api/type.rst:160
204215msgid ""
0 commit comments