11# SOME DESCRIPTIVE TITLE.
2- # Copyright (C) 2001-2024 , Python Software Foundation
2+ # Copyright (C) 2001-2025 , Python Software Foundation
33# This file is distributed under the same license as the Python package.
44# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55#
@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.12\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2024-11-01 14:52 +0000\n "
14+ "POT-Creation-Date : 2025-02-03 18:16 +0000\n "
1515"PO-Revision-Date : 2024-05-11 00:32+0000\n "
1616"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2024\n "
1717"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -635,17 +635,11 @@ msgid ""
635635"On success, return ``0``. On error, raise an exception and return ``-1``."
636636msgstr "如果成功,返回 ``0``。如果发生错误,引发异常并返回 ``-1``。"
637637
638- #: ../../c-api/module.rst:499
639- msgid ""
640- "Return ``-1`` if *value* is ``NULL``. It must be called with an exception "
641- "raised in this case."
642- msgstr "如果 *value* 为 ``NULL`` 则返回 ``-1``。 在此情况下调用它必须附带一个异常。"
643-
644- #: ../../c-api/module.rst:502 ../../c-api/module.rst:559
638+ #: ../../c-api/module.rst:499 ../../c-api/module.rst:560
645639msgid "Example usage::"
646640msgstr "用法示例::"
647641
648- #: ../../c-api/module.rst:504
642+ #: ../../c-api/module.rst:501
649643msgid ""
650644"static int\n"
651645"add_spam(PyObject *module, int value)\n"
@@ -671,13 +665,20 @@ msgstr ""
671665" return res;\n"
672666" }"
673667
674- #: ../../c-api/module.rst:516 ../../c-api/module.rst:577
668+ #: ../../c-api/module.rst:513
669+ msgid ""
670+ "To be convenient, the function accepts ``NULL`` *value* with an exception "
671+ "set. In this case, return ``-1`` and just leave the raised exception "
672+ "unchanged."
673+ msgstr ""
674+
675+ #: ../../c-api/module.rst:517 ../../c-api/module.rst:578
675676msgid ""
676677"The example can also be written without checking explicitly if *obj* is "
677678"``NULL``::"
678679msgstr "这个例子也可以写成不显式地检查 *obj* 是否为 ``NULL``::"
679680
680- #: ../../c-api/module.rst:519
681+ #: ../../c-api/module.rst:520
681682msgid ""
682683"static int\n"
683684"add_spam(PyObject *module, int value)\n"
@@ -697,14 +698,14 @@ msgstr ""
697698" return res;\n"
698699" }"
699700
700- #: ../../c-api/module.rst:528 ../../c-api/module.rst:593
701+ #: ../../c-api/module.rst:529 ../../c-api/module.rst:594
701702msgid ""
702703"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this"
703704" case, since *obj* can be ``NULL``."
704705msgstr ""
705706"注意在此情况下应当使用 ``Py_XDECREF()`` 而不是 ``Py_DECREF()``,因为 *obj* 可能为 ``NULL``。"
706707
707- #: ../../c-api/module.rst:531
708+ #: ../../c-api/module.rst:532
708709msgid ""
709710"The number of different *name* strings passed to this function should be "
710711"kept small, usually by only using statically allocated strings as *name*. "
@@ -718,14 +719,14 @@ msgstr ""
718719":c:func:`PyObject_SetAttr`。 更多相关细节,请参阅 "
719720":c:func:`PyUnicode_InternFromString`,它可在内部用于创建键对象。"
720721
721- #: ../../c-api/module.rst:544
722+ #: ../../c-api/module.rst:545
722723msgid ""
723724"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
724725"*value* on success (if it returns ``0``)."
725726msgstr ""
726727"类似于 :c:func:`PyModule_AddObjectRef`,但会在成功时偷取一个对 *value* 的引用(如果它返回 ``0`` 值)。"
727728
728- #: ../../c-api/module.rst:547
729+ #: ../../c-api/module.rst:548
729730msgid ""
730731"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is"
731732" easy to introduce reference leaks by misusing the "
@@ -734,19 +735,19 @@ msgstr ""
734735"推荐使用新的 :c:func:`PyModule_AddObjectRef` 函数,因为误用 :c:func:`PyModule_AddObject` "
735736"函数很容易导致引用泄漏。"
736737
737- #: ../../c-api/module.rst:553
738+ #: ../../c-api/module.rst:554
738739msgid ""
739740"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
740741"releases the reference to *value* **on success**."
741742msgstr "与其他窃取引用的函数不同,``PyModule_AddObject()`` 只在 **成功** 时释放对 *value* 的引用。"
742743
743- #: ../../c-api/module.rst:556
744+ #: ../../c-api/module.rst:557
744745msgid ""
745746"This means that its return value must be checked, and calling code must "
746747":c:func:`Py_DECREF` *value* manually on error."
747748msgstr "这意味着必须检查它的返回值,调用方必须在发生错误时手动为*value*调用 :c:func:`Py_DECREF`。"
748749
749- #: ../../c-api/module.rst:561
750+ #: ../../c-api/module.rst:562
750751msgid ""
751752"static int\n"
752753"add_spam(PyObject *module, int value)\n"
@@ -765,7 +766,7 @@ msgid ""
765766"}"
766767msgstr ""
767768
768- #: ../../c-api/module.rst:580
769+ #: ../../c-api/module.rst:581
769770msgid ""
770771"static int\n"
771772"add_spam(PyObject *module, int value)\n"
@@ -781,7 +782,7 @@ msgid ""
781782"}"
782783msgstr ""
783784
784- #: ../../c-api/module.rst:599
785+ #: ../../c-api/module.rst:600
785786msgid ""
786787"Add an integer constant to *module* as *name*. This convenience function "
787788"can be used from the module's initialization function. Return ``-1`` with an"
@@ -790,15 +791,15 @@ msgstr ""
790791"将一个整数常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块的初始化函数中使用。 当发生错误时将返回 ``-1`` "
791792"并设置一个异常,成功时则返回 ``0``。"
792793
793- #: ../../c-api/module.rst:603
794+ #: ../../c-api/module.rst:604
794795msgid ""
795796"This is a convenience function that calls :c:func:`PyLong_FromLong` and "
796797":c:func:`PyModule_AddObjectRef`; see their documentation for details."
797798msgstr ""
798799"这是一个调用 :c:func:`PyLong_FromLong` 和 :c:func:`PyModule_AddObjectRef` "
799800"的便捷函数;请参阅其文档了解详情。"
800801
801- #: ../../c-api/module.rst:609
802+ #: ../../c-api/module.rst:610
802803msgid ""
803804"Add a string constant to *module* as *name*. This convenience function can "
804805"be used from the module's initialization function. The string *value* must "
@@ -808,7 +809,7 @@ msgstr ""
808809"将一个字符串常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块初始化函数中使用。 字符串 *value* 必须以 "
809810"``NULL`` 结尾。 当发生错误时将返回 ``-1``,成功时则返回 ``0``。"
810811
811- #: ../../c-api/module.rst:614
812+ #: ../../c-api/module.rst:615
812813msgid ""
813814"This is a convenience function that calls "
814815":c:func:`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; "
@@ -817,7 +818,7 @@ msgstr ""
817818"这是一个调用 :c:func:`PyUnicode_InternFromString` 和 "
818819":c:func:`PyModule_AddObjectRef` 的便捷函数;请参阅其文档了解详情。"
819820
820- #: ../../c-api/module.rst:621
821+ #: ../../c-api/module.rst:622
821822msgid ""
822823"Add an int constant to *module*. The name and the value are taken from "
823824"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
@@ -828,11 +829,11 @@ msgstr ""
828829"AF_INET)`` 将值为 *AF_INET* 的整数常量 *AF_INET* 添加到 *module* 中。 当发生错误时将抬 ``-1`` "
829830"并设置一个异常,成功时将返回 ``0``。"
830831
831- #: ../../c-api/module.rst:629
832+ #: ../../c-api/module.rst:630
832833msgid "Add a string constant to *module*."
833834msgstr "将一个字符串常量添加到*module*模块中。"
834835
835- #: ../../c-api/module.rst:633
836+ #: ../../c-api/module.rst:634
836837msgid ""
837838"Add a type object to *module*. The type object is finalized by calling "
838839"internally :c:func:`PyType_Ready`. The name of the type object is taken from"
@@ -843,25 +844,25 @@ msgstr ""
843844":c:member:`~PyTypeObject.tp_name` 在点号之后的部分。 当发生错误时将返回 ``-1`` 并设置一个异常,成功时将返回 "
844845"``0``。"
845846
846- #: ../../c-api/module.rst:643
847+ #: ../../c-api/module.rst:644
847848msgid "Module lookup"
848849msgstr "查找模块"
849850
850- #: ../../c-api/module.rst:645
851+ #: ../../c-api/module.rst:646
851852msgid ""
852853"Single-phase initialization creates singleton modules that can be looked up "
853854"in the context of the current interpreter. This allows the module object to "
854855"be retrieved later with only a reference to the module definition."
855856msgstr "单阶段初始化创建可以在当前解释器上下文中被查找的单例模块。这使得仅通过模块定义的引用,就可以检索模块对象。"
856857
857- #: ../../c-api/module.rst:649
858+ #: ../../c-api/module.rst:650
858859msgid ""
859860"These functions will not work on modules created using multi-phase "
860861"initialization, since multiple such modules can be created from a single "
861862"definition."
862863msgstr "这些函数不适用于通过多阶段初始化创建的模块,因为可以从一个模块定义创建多个模块对象。"
863864
864- #: ../../c-api/module.rst:654
865+ #: ../../c-api/module.rst:655
865866msgid ""
866867"Returns the module object that was created from *def* for the current "
867868"interpreter. This method requires that the module object has been attached "
@@ -872,18 +873,18 @@ msgstr ""
872873"返回当前解释器中由 *def* 创建的模块对象。此方法要求模块对象此前已通过 :c:func:`PyState_AddModule` "
873874"函数附加到解释器状态中。如果找不到相应的模块对象,或模块对象还未附加到解释器状态,返回 ``NULL``。"
874875
875- #: ../../c-api/module.rst:661
876+ #: ../../c-api/module.rst:662
876877msgid ""
877878"Attaches the module object passed to the function to the interpreter state. "
878879"This allows the module object to be accessible via "
879880":c:func:`PyState_FindModule`."
880881msgstr "将传给函数的模块对象附加到解释器状态。 这将允许通过 :c:func:`PyState_FindModule` 来访问该模块对象。"
881882
882- #: ../../c-api/module.rst:664
883+ #: ../../c-api/module.rst:665
883884msgid "Only effective on modules created using single-phase initialization."
884885msgstr "仅在使用单阶段初始化创建的模块上有效。"
885886
886- #: ../../c-api/module.rst:666
887+ #: ../../c-api/module.rst:667
887888msgid ""
888889"Python calls ``PyState_AddModule`` automatically after importing a module, "
889890"so it is unnecessary (but harmless) to call it from module initialization "
@@ -897,15 +898,15 @@ msgstr ""
897898"显式的调用仅在模块自己的初始化代码后继调用了 ``PyState_FindModule`` 的情况下才是必要的。 "
898899"此函数主要是为了实现替代导入机制(或是通过直接调用它,或是通过引用它的实现来获取所需的状态更新详情)。"
899900
900- #: ../../c-api/module.rst:674 ../../c-api/module.rst:685
901+ #: ../../c-api/module.rst:675 ../../c-api/module.rst:686
901902msgid "The caller must hold the GIL."
902903msgstr "调用时必须携带GIL。"
903904
904- #: ../../c-api/module.rst:676
905+ #: ../../c-api/module.rst:677
905906msgid "Return ``-1`` with an exception set on error, ``0`` on success."
906907msgstr "出错时返回 ``-1`` 并设置一个异常,成功时返回 ``0``。"
907908
908- #: ../../c-api/module.rst:682
909+ #: ../../c-api/module.rst:683
909910msgid ""
910911"Removes the module object created from *def* from the interpreter state. "
911912"Return ``-1`` with an exception set on error, ``0`` on success."
0 commit comments