@@ -4693,6 +4693,10 @@ msgid ""
4693
4693
"``0`` on insertion, and ``1`` if the key was already present in the "
4694
4694
"dictionary. (Contributed by Sam Gross in :gh:`112066`.)"
4695
4695
msgstr ""
4696
+ "增加了 :c:func:`PyDict_SetDefaultRef` 函数,其行为类似于 "
4697
+ ":c:func:`PyDict_SetDefault`,但将返回一个 :term:`strong reference` 而不是 "
4698
+ ":term:`borrowed reference`。 此函数在出错时将返回 ``-1``,插入时返回 ``0``,而在键已存在于字典中时返回 "
4699
+ "``1``。 (由 Sam Gross 在 :gh:`112066` 中贡献。)"
4696
4700
4697
4701
#: ../../whatsnew/3.13.rst:2106
4698
4702
msgid ""
@@ -4702,6 +4706,9 @@ msgid ""
4702
4706
":exc:`KeyError` is not raised for missing keys. (Contributed by Stefan "
4703
4707
"Behnel and Victor Stinner in :gh:`111262`.)"
4704
4708
msgstr ""
4709
+ "增加了 :c:func:`PyDict_Pop` 和 :c:func:`PyDict_PopString` 函数用于从字典移除键并可选择返回被移除的值。"
4710
+ " 这类似于 :meth:`dict.pop`,但是没有默认值,且对缺失的键不会引发 :exc:`KeyError`。 (由 Stefan Behnel "
4711
+ "和 Victor Stinner 在 :gh:`111262` 中贡献。)"
4705
4712
4706
4713
#: ../../whatsnew/3.13.rst:2113
4707
4714
msgid ""
@@ -4713,6 +4720,11 @@ msgid ""
4713
4720
"convenient and faster if a missing key should not be treated as a failure. "
4714
4721
"(Contributed by Serhiy Storchaka in :gh:`106307`.)"
4715
4722
msgstr ""
4723
+ "增加了 :c:func:`PyMapping_GetOptionalItem` 和 "
4724
+ ":c:func:`PyMapping_GetOptionalItemString` 函数分别作为 :c:func:`PyObject_GetItem` "
4725
+ "和 :c:func:`PyMapping_GetItemString` 的替代。 这些新函数在映射中缺失所请求的键时不会引发 "
4726
+ ":exc:`KeyError`。 这些变体形式在键缺失不应被视为执行失败的场合下更为方便和快速。 (由 Serhiy Storchaka 在 "
4727
+ ":gh:`106307` 中贡献。)"
4716
4728
4717
4729
#: ../../whatsnew/3.13.rst:2123
4718
4730
msgid ""
@@ -4724,20 +4736,30 @@ msgid ""
4724
4736
"convenient and faster if the missing attribute should not be treated as a "
4725
4737
"failure. (Contributed by Serhiy Storchaka in :gh:`106521`.)"
4726
4738
msgstr ""
4739
+ "增加了 :c:func:`PyObject_GetOptionalAttr` 和 "
4740
+ ":c:func:`PyObject_GetOptionalAttrString` 函数分别作为 :c:func:`PyObject_GetAttr` "
4741
+ "和 :c:func:`PyObject_GetAttrString` 的替代。 这些新函数在对象中未找到所请求的属性时不会引发 "
4742
+ ":exc:`AttributeError`。 这些变体形式在属性缺失不应被视为执行失败的场合下更为方便和快速。 (由 Serhiy Storchaka "
4743
+ "在 :gh:`106521` 中贡献。)"
4727
4744
4728
4745
#: ../../whatsnew/3.13.rst:2133
4729
4746
msgid ""
4730
4747
"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to "
4731
4748
":c:func:`PyErr_WriteUnraisable` that allows customizing the warning message."
4732
4749
" (Contributed by Serhiy Storchaka in :gh:`108082`.)"
4733
4750
msgstr ""
4751
+ "增加了 :c:func:`PyErr_FormatUnraisable` 函数作为对 :c:func:`PyErr_WriteUnraisable` "
4752
+ "的扩展,它允许自定义警告消息。 (由 Serhiy Storchaka 在 :gh:`108082` 中贡献。)"
4734
4753
4735
4754
#: ../../whatsnew/3.13.rst:2138
4736
4755
msgid ""
4737
4756
"Add new functions that return a :term:`strong reference` instead of a "
4738
4757
":term:`borrowed reference` for frame locals, globals, and builtins, as part "
4739
4758
"of :ref:`PEP 667 <whatsnew313-locals-semantics>`:"
4740
4759
msgstr ""
4760
+ "作为 :ref:`PEP 667 <whatsnew313-locals-semantics>` 的一部分,增加了一组针对帧的 locals, "
4761
+ "globals 和 builtins 返回 :term:`strong reference` 而不是 :term:`borrowed "
4762
+ "reference` 的函数:"
4741
4763
4742
4764
#: ../../whatsnew/3.13.rst:2142
4743
4765
msgid ""
@@ -4815,6 +4837,8 @@ msgid ""
4815
4837
":c:func:`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead "
4816
4838
"of a C :c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)"
4817
4839
msgstr ""
4840
+ "增加了 :c:func:`PyLong_AsInt` 函数。 其行为类似于 :c:func:`PyLong_AsLong`,但会将结果存储于一个 C "
4841
+ ":c:expr:`int` 而不是 C :c:expr:`long` 。 (由 Victor Stinner 在 :gh:`108014` 中贡献。)"
4818
4842
4819
4843
#: ../../whatsnew/3.13.rst:2179
4820
4844
msgid ""
@@ -4823,6 +4847,9 @@ msgid ""
4823
4847
"converting between native integer types and Python :class:`int` objects. "
4824
4848
"(Contributed by Steve Dower in :gh:`111140`.)"
4825
4849
msgstr ""
4850
+ "增加了 :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes` 和 "
4851
+ ":c:func:`PyLong_FromUnsignedNativeBytes` 等函数以简化原生整数类型与 Python :class:`int` "
4852
+ "对象之间的转换。 (由 Steve Dower 在 :gh:`111140` 中贡献。)"
4826
4853
4827
4854
#: ../../whatsnew/3.13.rst:2185
4828
4855
msgid ""
0 commit comments