@@ -924,27 +924,30 @@ msgid ""
924
924
"As you can see, the source code closely resembles the :class:`Custom` "
925
925
"examples in previous sections. We will break down the main differences "
926
926
"between them. ::"
927
- msgstr ""
927
+ msgstr "如你所见,此源代码与之前小节中的 :class:`Custom` 示例非常相似。 我们将逐一讲解它们之间的主要区别。 :: "
928
928
929
929
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:828
930
930
msgid ""
931
931
"The primary difference for derived type objects is that the base type's "
932
932
"object structure must be the first value. The base type will already "
933
933
"include the :c:func:`PyObject_HEAD` at the beginning of its structure."
934
934
msgstr ""
935
+ "派生类型对象的主要差异在于基类型的对象结构体必须是第一个值。 基类型将已经在其结构体的开头包括了 :c:func:`PyObject_HEAD`。"
935
936
936
937
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:832
937
938
msgid ""
938
939
"When a Python object is a :class:`SubList` instance, its ``PyObject *`` "
939
940
"pointer can be safely cast to both ``PyListObject *`` and ``SubListObject "
940
941
"*``::"
941
942
msgstr ""
943
+ "当一个 Python 对象是 :class:`SubList` 的实例时,它的 ``PyObject *`` 指针可以被安全地强制转换为 "
944
+ "``PyListObject *`` 和 ``SubListObject *``::"
942
945
943
946
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:844
944
947
msgid ""
945
948
"We see above how to call through to the :attr:`__init__` method of the base "
946
949
"type."
947
- msgstr ""
950
+ msgstr "我们可以在上面看到如何调用至基类型的 :attr:`__init__` 方法。 "
948
951
949
952
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:847
950
953
msgid ""
@@ -955,6 +958,11 @@ msgid ""
955
958
":c:member:`~PyTypeObject.tp_alloc`, but let the base class handle it by "
956
959
"calling its own :c:member:`~PyTypeObject.tp_new`."
957
960
msgstr ""
961
+ "这个模式在编写具有自定义 :c:member:`~PyTypeObject.tp_new` 和 "
962
+ ":c:member:`~PyTypeObject.tp_dealloc` 成员的类型时很重要。 "
963
+ ":c:member:`~PyTypeObject.tp_new` 处理句柄不应为具有 "
964
+ ":c:member:`~PyTypeObject.tp_alloc` 的对象实际分配内存,而是让基类通过调用自己的 "
965
+ ":c:member:`~PyTypeObject.tp_new` 来处理它。"
958
966
959
967
#: /home/runner/work/docspush-transifex/docspush-transifex/cpython/Doc/extending/newtypes_tutorial.rst:853
960
968
msgid ""
0 commit comments