@@ -1304,13 +1304,17 @@ msgid ""
13041304"that may be ``NULL`` is received, for example, from :c:func:`malloc` or from"
13051305" a function that may raise an exception."
13061306msgstr ""
1307+ "更好的做法是仅在“源头”上检测 ``NULL``,即在接收到一个可能为 ``NULL`` 的指针,例如来自 :c:func:`malloc` "
1308+ "或是一个可能引发异常的函数的时候。"
13071309
13081310#: ../../extending/extending.rst:1106
13091311msgid ""
13101312"The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for "
13111313"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and "
13121314":c:func:`Py_XDECREF` do."
13131315msgstr ""
1316+ ":c:func:`Py_INCREF` 和 :c:func:`Py_DECREF` 等宏不会检测 ``NULL`` 指针 --- 但是,它们的变种 "
1317+ ":c:func:`Py_XINCREF` 和 :c:func:`Py_XDECREF` 则会检测。"
13141318
13151319#: ../../extending/extending.rst:1110
13161320msgid ""
@@ -1320,19 +1324,23 @@ msgid ""
13201324"expected types, and this would generate redundant tests. There are no "
13211325"variants with ``NULL`` checking."
13221326msgstr ""
1327+ "用于检测特定对象类型的宏 (``Pytype_Check()``) 不会检测 ``NULL`` 指针 --- "
1328+ "同样地,有大量代码会连续调用这些宏来测试一个对象是否为几种不同预期类型之一,这将会生成冗余的测试。 不存在带有 ``NULL`` 检测的变体。"
13231329
13241330#: ../../extending/extending.rst:1116
13251331msgid ""
13261332"The C function calling mechanism guarantees that the argument list passed to"
13271333" C functions (``args`` in the examples) is never ``NULL`` --- in fact it "
13281334"guarantees that it is always a tuple [#]_."
13291335msgstr ""
1336+ "C 函数调用机制会保证传给 C 函数的参数列表 (本示例中为 ``args``) 绝不会为 ``NULL`` --- 实际上它会保证其总是为一个元组 "
1337+ "[#]_。"
13301338
13311339#: ../../extending/extending.rst:1120
13321340msgid ""
13331341"It is a severe error to ever let a ``NULL`` pointer \" escape\" to the Python"
13341342" user."
1335- msgstr ""
1343+ msgstr "任何时候将 ``NULL`` 指针“泄露”给 Python 用户都会是个严重的错误。 "
13361344
13371345#: ../../extending/extending.rst:1131
13381346msgid "Writing Extensions in C++"
@@ -1439,6 +1447,9 @@ msgid ""
14391447"of runtime type-safety; there is no feasible way to tell one unnamed Capsule"
14401448" from another."
14411449msgstr ""
1450+ "无论你选择哪个方法,正确地为你的 Capsule 命名都很重要。 函数 :c:func:`PyCapsule_New` 接受一个名称形参 "
1451+ "(:c:type:`const char \\ *`);允许你传入一个 ``NULL`` 作为名称,但我们强烈建议你指定一个名称。 正确地命名的 "
1452+ "Capsule 提供了一定程序的运行时类型安全;没有可行的方式能区分两个未命名的 Capsule。"
14421453
14431454#: ../../extending/extending.rst:1200
14441455msgid ""
0 commit comments