@@ -835,13 +835,17 @@ msgid ""
835835"``raise ... from ...``) associated with the exception as a new reference, as"
836836" accessible from Python through :attr:`__cause__`."
837837msgstr ""
838+ "将与异常相关联的原因(一个异常实例,或是 :const:`None`,由 ``raise ... from ...`` 设置)作为一个新引用返回,可在 "
839+ "Python 中通过 :attr:`__cause__` 来访问。"
838840
839841#: ../../c-api/exceptions.rst:659
840842msgid ""
841843"Set the cause associated with the exception to *cause*. Use ``NULL`` to "
842844"clear it. There is no type check to make sure that *cause* is either an "
843845"exception instance or :const:`None`. This steals a reference to *cause*."
844846msgstr ""
847+ "将与异常相关联的原因设置为 *cause*。 使用 ``NULL`` 来清空它。 它没有用来确保 *cause* 是一个异常实例或 "
848+ ":const:`None` 的类型检查。 这将偷取一个指向 *cause* 的引用。"
845849
846850#: ../../c-api/exceptions.rst:663
847851msgid ""
@@ -965,6 +969,9 @@ msgid ""
965969"implementations because the :ref:`call protocol <call>` takes care of "
966970"recursion handling."
967971msgstr ""
972+ "这两个函数提供了一种在 C 层级上进行安全的递归调用的方式,在核心模块与扩展模块中均适用。 当递归代码不一定会发起调用 Python "
973+ "代码(后者会自动跟踪其递归深度)时就需要用到它们。 它们对于 *tp_call* 实现来说也无必要因为 :ref:`调用协议 <call>` "
974+ "会负责递归处理。"
968975
969976#: ../../c-api/exceptions.rst:769
970977msgid "Marks a point where a recursive C-level call is about to be performed."
@@ -985,6 +992,7 @@ msgid ""
985992"case, a :exc:`RecursionError` is set and a nonzero value is returned. "
986993"Otherwise, zero is returned."
987994msgstr ""
995+ "随后此函数将检查是否达到递归限制。 如果是的话,将设置一个 :exc:`RecursionError` 并返回一个非零值。 在其他情况下,则返回零。"
988996
989997#: ../../c-api/exceptions.rst:779
990998msgid ""
@@ -1004,6 +1012,8 @@ msgid ""
10041012"Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each "
10051013"*successful* invocation of :c:func:`Py_EnterRecursiveCall`."
10061014msgstr ""
1015+ "结束一个 :c:func:`Py_EnterRecursiveCall`。 必须针对 :c:func:`Py_EnterRecursiveCall` "
1016+ "的每个 *成功的* 发起调用操作执行一次调用。"
10071017
10081018#: ../../c-api/exceptions.rst:794
10091019msgid ""
@@ -1013,12 +1023,15 @@ msgid ""
10131023"cycles. The following two functions facilitate this functionality. "
10141024"Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`."
10151025msgstr ""
1026+ "正确地针对容器类型实现 :c:member:`~PyTypeObject.tp_repr` 需要特别的递归处理。 "
1027+ "在保护栈之外,:c:member:`~PyTypeObject.tp_repr` 还需要追踪对象以防止出现循环。 以下两个函数将帮助完成此功能。 "
1028+ "从实际效果来说,这两个函数是 C 中对应 :func:`reprlib.recursive_repr` 的等价物。"
10161029
10171030#: ../../c-api/exceptions.rst:802
10181031msgid ""
10191032"Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` "
10201033"implementation to detect cycles."
1021- msgstr ""
1034+ msgstr "在 :c:member:`~PyTypeObject.tp_repr` 实现的开头被调用以检测循环。 "
10221035
10231036#: ../../c-api/exceptions.rst:805
10241037msgid ""
@@ -1028,19 +1041,24 @@ msgid ""
10281041":class:`dict` objects return ``{...}`` and :class:`list` objects return "
10291042"``[...]``."
10301043msgstr ""
1044+ "如果对象已经被处理,此函数将返回一个正整数。 在此情况下 :c:member:`~PyTypeObject.tp_repr` "
1045+ "实现应当返回一个指明发生循环的字符串对象。 例如,:class:`dict` 对象将返回 ``{...}`` 而 :class:`list` 对象将返回"
1046+ " ``[...]``。"
10311047
10321048#: ../../c-api/exceptions.rst:811
10331049msgid ""
10341050"The function will return a negative integer if the recursion limit is "
10351051"reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation "
10361052"should typically return ``NULL``."
10371053msgstr ""
1054+ "如果已达到递归限制则此函数将返回一个负正数。 在此情况下 :c:member:`~PyTypeObject.tp_repr` 实现通常应当返回 "
1055+ "``NULL``。"
10381056
10391057#: ../../c-api/exceptions.rst:815
10401058msgid ""
10411059"Otherwise, the function returns zero and the "
10421060":c:member:`~PyTypeObject.tp_repr` implementation can continue normally."
1043- msgstr ""
1061+ msgstr "在其他情况下,此函数将返回零而 :c:member:`~PyTypeObject.tp_repr` 实现将可正常继续。 "
10441062
10451063#: ../../c-api/exceptions.rst:820
10461064msgid ""
0 commit comments