@@ -4125,6 +4125,9 @@ msgid ""
4125
4125
"compatibility, catch both :exc:`NotImplementedError` or the appropriate "
4126
4126
"exception as needed."
4127
4127
msgstr ""
4128
+ "在 :mod:`importlib.abc` 中定义的 ABC 现在将会引发适当的异常或是返回默认值而不是无脑引发 "
4129
+ ":exc:`NotImplementedError`。 这将只影响调用 :func:`super` 并一路下落到这些 ABC 的代码。 "
4130
+ "为保持兼容性,:exc:`NotImplementedError` 和所需的相应异常都要被捕获。"
4128
4131
4129
4132
#: ../../whatsnew/3.4.rst:2274
4130
4133
msgid ""
@@ -4133,6 +4136,9 @@ msgid ""
4133
4136
"if these attributes were set in a backwards-compatible fashion, use e.g. "
4134
4137
"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)"
4135
4138
msgstr ""
4139
+ "模块类型现在默认会将 :attr:`~module.__package__` 和 :attr:`~module.__loader__` 属性初始化为 "
4140
+ "``None``。 要确定这些属性是否以向下兼容的方式被设置,可使用像 ``getattr(module, '__loader__', None) is"
4141
+ " not None`` 这样的写法。 (:issue:`17115`。)"
4136
4142
4137
4143
#: ../../whatsnew/3.4.rst:2280
4138
4144
msgid ""
@@ -4141,6 +4147,9 @@ msgid ""
4141
4147
"not desired then you will need to set these attributes manually. You can use"
4142
4148
" :func:`importlib.util.module_to_load` for module management."
4143
4149
msgstr ""
4150
+ "现在 :meth:`!importlib.util.module_for_loader` 会无条件地设置 ``__loader__`` 和 "
4151
+ "``__package__`` 以正确地支持重加载。 如果不希望如此那么你将需要手动设置这些属性。 你可以使用 "
4152
+ ":func:`importlib.util.module_to_load` 进行模块管理。"
4144
4153
4145
4154
#: ../../whatsnew/3.4.rst:2285
4146
4155
msgid ""
@@ -4149,6 +4158,9 @@ msgid ""
4149
4158
"reloading. Note that this restores a pre-3.3 behavior in that it means a "
4150
4159
"module is re-found when re-loaded (:issue:`19413`)."
4151
4160
msgstr ""
4161
+ "当重载时 import 操作现在会无条件地重置相关属性 (例如 ``__name__``, ``__loader__``, "
4162
+ "``__package__``, ``__file__``, ``__cached__``)。 请注意在模块重载时会被重发现这一点上该操作恢复了 3.3"
4163
+ " 之前的行为 (:issue:`19413`)。"
4152
4164
4153
4165
#: ../../whatsnew/3.4.rst:2290
4154
4166
msgid ""
@@ -4463,6 +4475,11 @@ msgid ""
4463
4475
"when invoking these operations (directly or indirectly) and running against "
4464
4476
"a version of Python that is compiled with assertions enabled."
4465
4477
msgstr ""
4478
+ "现在 :c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr` 和 "
4479
+ ":c:func:`PyObject_Str` 以及其他一些内部 C API "
4480
+ "都包括了一个调试断言,以确保它们不会在可能会静默地丢弃当前活动异常的情况下使用。 在预期并且希望丢弃活动异常的情况下(例如,由于已通过 "
4481
+ ":c:func:`PyErr_Fetch` 将其保存在本地或是有意将其替换为不同的异常 ),则需调用显式的 :c:func:`PyErr_Clear` "
4482
+ "以避免在(直接或间接)唤起这些操作和针对启用断言编译的 Python 的版本运行时触发断言。"
4466
4483
4467
4484
#: ../../whatsnew/3.4.rst:2500
4468
4485
msgid ""
0 commit comments