@@ -1401,6 +1401,8 @@ msgid ""
14011401"object is implicitly created when an exception occurs, and may also be "
14021402"explicitly created by calling :class:`types.TracebackType`."
14031403msgstr ""
1404+ "回溯对象表示一个异常的栈跟踪记录。当异常发生时会隐式地创建一个回溯对象,也可能通过调用 :class:`types.TracebackType` "
1405+ "显式地创建。"
14041406
14051407#: ../../reference/datamodel.rst:1025
14061408msgid ""
@@ -1412,6 +1414,9 @@ msgid ""
14121414"``sys.exc_info()``, and as the ``__traceback__`` attribute of the caught "
14131415"exception."
14141416msgstr ""
1417+ "对于隐式地创建的回溯对象,当查找异常句柄使得执行栈展开时,会在每个展开层级的当前回溯之前插入一个回溯对象。当进入一个异常句柄时,栈跟踪将对程序启用。(参见"
1418+ " :ref:`try` 一节。) 它可作为 ``sys.exc_info()`` 所返回的元组的第三项,以及所捕获异常的 "
1419+ "``__traceback__`` 属性被获取。"
14151420
14161421#: ../../reference/datamodel.rst:1033
14171422msgid ""
@@ -1420,13 +1425,15 @@ msgid ""
14201425"interactive, it is also made available to the user as "
14211426"``sys.last_traceback``."
14221427msgstr ""
1428+ "当程序不包含可用的句柄时,栈跟踪会 (以良好的格式) 写入标准错误流;如果解释器处于交互模式,它也可作为 ``sys.last_traceback`` "
1429+ "对用户启用。"
14231430
14241431#: ../../reference/datamodel.rst:1038
14251432msgid ""
14261433"For explicitly created tracebacks, it is up to the creator of the traceback "
14271434"to determine how the ``tb_next`` attributes should be linked to form a full "
14281435"stack trace."
1429- msgstr ""
1436+ msgstr "对于显式创建的回溯对象,则由回溯对象的创建者来决定应该如何链接 ``tb_next`` 属性来构成完整的栈跟踪。 "
14301437
14311438#: ../../reference/datamodel.rst:1048
14321439msgid ""
@@ -1437,19 +1444,22 @@ msgid ""
14371444"number of its frame object if the exception occurred in a :keyword:`try` "
14381445"statement with no matching except clause or with a finally clause."
14391446msgstr ""
1447+ "特殊的只读属性: :attr:`tb_frame` 指向当前层级的执行帧; :attr:`tb_lineno` 给出发生异常所在的行号; "
1448+ ":attr:`tb_lasti` 标示具体指令。如果异常发生于没有匹配的 except 子句或有 finally 子句的 :keyword:`try` "
1449+ "语句中,回溯对象中的行号和最后指令可能与相应帧对象中行号不同。"
14401450
14411451#: ../../reference/datamodel.rst:1060
14421452msgid ""
14431453"Special writable attribute: :attr:`tb_next` is the next level in the stack "
14441454"trace (towards the frame where the exception occurred), or ``None`` if there"
14451455" is no next level."
1446- msgstr ""
1456+ msgstr "特殊的可写属性: :attr:`tb_next` 为栈跟踪中的下一层级 (通往发生异常的帧),如果没有下一层级则为 ``None``。 "
14471457
14481458#: ../../reference/datamodel.rst:1064
14491459msgid ""
14501460"Traceback objects can now be explicitly instantiated from Python code, and "
14511461"the ``tb_next`` attribute of existing instances can be updated."
1452- msgstr ""
1462+ msgstr "回溯对象现在可以使用 Python 代码显式地实例化,现有实例的 ``tb_next`` 属性可以被更新。 "
14531463
14541464#: ../../reference/datamodel.rst:1092
14551465msgid "Slice objects"
0 commit comments