@@ -292,6 +292,10 @@ msgid ""
292292"defines the method. See :c:func:`PyType_GetModuleByDef` for cases when "
293293":c:type:`!PyCMethod` cannot be used."
294294msgstr ""
295+ "此函数通常被用于获取方法定义所在的模块。 请注意在这样的方法中,``PyType_GetModule(Py_TYPE(self))`` "
296+ "可能不会返回预期的结果。 ``Py_TYPE(self)`` 可以是目标类的一个 *子类*,而子类并不一定是在与其超类相同的模块中定义的。 请参阅 "
297+ ":c:type:`PyCMethod` 了解如何获取方法定义所在的类。 请参阅 :c:func:`PyType_GetModuleByDef` "
298+ "了解有关无法使用 :c:type:`!PyCMethod` 的情况。"
295299
296300#: ../../c-api/type.rst:225
297301msgid ""
@@ -356,13 +360,17 @@ msgid ""
356360"Create and return a :ref:`heap type <heap-types>` from the *spec* (see "
357361":c:macro:`Py_TPFLAGS_HEAPTYPE`)."
358362msgstr ""
363+ "根据 *spec* (参见 :c:macro:`Py_TPFLAGS_HEAPTYPE`) 创建并返回一个 :ref:`堆类型 <heap-"
364+ "types>`。"
359365
360366#: ../../c-api/type.rst:273
361367msgid ""
362368"The metaclass *metaclass* is used to construct the resulting type object. "
363369"When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or "
364370"*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)."
365371msgstr ""
372+ "元类 *metaclass* 用于构建结果类型对象。 当 *metaclass* 为 ``NULL`` 时,元类将派生自 *bases* (或者如果 "
373+ "*bases* 为 ``NULL`` 则派生自 *Py_tp_base[s]* 槽位,见下文)。"
366374
367375#: ../../c-api/type.rst:277
368376msgid ""
@@ -372,6 +380,9 @@ msgid ""
372380"``tp_new``, which may result in incomplete initialization. This is "
373381"deprecated and in Python 3.14+ such metaclasses will not be supported.)"
374382msgstr ""
383+ "不支持重载 :c:member:`~PyTypeObject.tp_new` 的元类,除非 ``tp_new`` 为 ``NULL``。 "
384+ "(为了向下兼容,其他 ``PyType_From*`` 函数允许这样的元类。 它们将忽略 ``tp_new``,可能导致不完整的初始化。 "
385+ "这样的元类已被弃用并在 Python 3.14+ 中停止支持。)"
375386
376387#: ../../c-api/type.rst:284
377388msgid ""
@@ -409,6 +420,9 @@ msgid ""
409420":py:class:`type` (or the metaclass) over ``PyType_From*`` functions. "
410421"Specifically:"
411422msgstr ""
423+ "请注意此函数 *不能* 完全匹配调用 :py:class:`type() <type>` 或使用 :keyword:`class` 语句的行为。 "
424+ "对于用户提供的类型或元类,推荐 :ref:`调用 <capi-call>` :py:class:`type` (或元类) 而不是 "
425+ "``PyType_From*`` 函数。 特别地:"
412426
413427#: ../../c-api/type.rst:306
414428msgid ""
@@ -442,7 +456,7 @@ msgstr "此函数现在接受一个单独类作为 *bases* 参数并接受 ``NUL
442456msgid ""
443457"The function now finds and uses a metaclass corresponding to the provided "
444458"base classes. Previously, only :class:`type` instances were returned."
445- msgstr ""
459+ msgstr "该函数现在可以找到并使用与所提供的基类相对应的元类。 在此之前,只会返回 :class:`type` 实例。 "
446460
447461#: ../../c-api/type.rst:330 ../../c-api/type.rst:347 ../../c-api/type.rst:363
448462msgid ""
@@ -451,21 +465,24 @@ msgid ""
451465"overrides :c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+"
452466" it will be no longer allowed."
453467msgstr ""
468+ "元类的 :c:member:`~PyTypeObject.tp_new` 将被 *忽略*。 这可能导致不完整的初始化。 创建元类重载 "
469+ ":c:member:`~PyTypeObject.tp_new` 的类的做法已被弃用并且在 Python 3.14+ 中将不再被允许。"
454470
455471#: ../../c-api/type.rst:338
456472msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``."
457- msgstr ""
473+ msgstr "等价于 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。 "
458474
459475#: ../../c-api/type.rst:355
460476msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``."
461- msgstr ""
477+ msgstr "等价于 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。 "
462478
463479#: ../../c-api/type.rst:359
464480msgid ""
465481"The function now finds and uses a metaclass corresponding to the base "
466482"classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` "
467483"instances were returned."
468484msgstr ""
485+ "该函数现在可以找到并使用与 *Py_tp_base[s]* 槽位中提供的基类相对应的元类。 在此之前,只会返回 :class:`type` 实例。"
469486
470487#: ../../c-api/type.rst:380
471488msgid "Structure defining a type's behavior."
0 commit comments