@@ -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-09-13 14:48 +0000\n "
14+ "POT-Creation-Date : 2024-10-04 14:53 +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 "
@@ -636,7 +636,7 @@ msgid ""
636636"raised in this case."
637637msgstr "如果 *value* 为 ``NULL`` 则返回 ``-1``。 在此情况下调用它必须附带一个异常。"
638638
639- #: ../../c-api/module.rst:500 ../../c-api/module.rst:549
639+ #: ../../c-api/module.rst:500 ../../c-api/module.rst:557
640640msgid "Example usage::"
641641msgstr "用法示例::"
642642
@@ -666,7 +666,7 @@ msgstr ""
666666" return res;\n"
667667" }"
668668
669- #: ../../c-api/module.rst:514 ../../c-api/module.rst:567
669+ #: ../../c-api/module.rst:514 ../../c-api/module.rst:575
670670msgid ""
671671"The example can also be written without checking explicitly if *obj* is "
672672"``NULL``::"
@@ -692,21 +692,35 @@ msgstr ""
692692" return res;\n"
693693" }"
694694
695- #: ../../c-api/module.rst:526 ../../c-api/module.rst:583
695+ #: ../../c-api/module.rst:526 ../../c-api/module.rst:591
696696msgid ""
697697"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this"
698698" case, since *obj* can be ``NULL``."
699699msgstr ""
700700"注意在此情况下应当使用 ``Py_XDECREF()`` 而不是 ``Py_DECREF()``,因为 *obj* 可能为 ``NULL``。"
701701
702- #: ../../c-api/module.rst:534
702+ #: ../../c-api/module.rst:529
703+ msgid ""
704+ "The number of different *name* strings passed to this function should be "
705+ "kept small, usually by only using statically allocated strings as *name*. "
706+ "For names that aren't known at compile time, prefer calling "
707+ ":c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For "
708+ "more details, see :c:func:`PyUnicode_InternFromString`, which may be used "
709+ "internally to create a key object."
710+ msgstr ""
711+ "传给该函数的不同 *name* 字符串应当保持在较少的数量,通常是通过仅使用静态分配的字符串作为 *name* 来做到这一点。 "
712+ "对于编译时未知的名称,建议直接调用 :c:func:`PyUnicode_FromString` 和 "
713+ ":c:func:`PyObject_SetAttr`。 更多相关细节,请参阅 "
714+ ":c:func:`PyUnicode_InternFromString`,它可在内部用于创建键对象。"
715+
716+ #: ../../c-api/module.rst:542
703717msgid ""
704718"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
705719"*value* on success (if it returns ``0``)."
706720msgstr ""
707721"类似于 :c:func:`PyModule_AddObjectRef`,但会在成功时偷取一个对 *value* 的引用(如果它返回 ``0`` 值)。"
708722
709- #: ../../c-api/module.rst:537
723+ #: ../../c-api/module.rst:545
710724msgid ""
711725"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is"
712726" easy to introduce reference leaks by misusing the "
@@ -715,19 +729,19 @@ msgstr ""
715729"推荐使用新的 :c:func:`PyModule_AddObjectRef` 函数,因为误用 :c:func:`PyModule_AddObject` "
716730"函数很容易导致引用泄漏。"
717731
718- #: ../../c-api/module.rst:543
732+ #: ../../c-api/module.rst:551
719733msgid ""
720734"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
721735"releases the reference to *value* **on success**."
722736msgstr "与其他窃取引用的函数不同,``PyModule_AddObject()`` 只在 **成功** 时释放对 *value* 的引用。"
723737
724- #: ../../c-api/module.rst:546
738+ #: ../../c-api/module.rst:554
725739msgid ""
726740"This means that its return value must be checked, and calling code must "
727741":c:func:`Py_DECREF` *value* manually on error."
728742msgstr "这意味着必须检查它的返回值,调用方必须在发生错误时手动为*value*调用 :c:func:`Py_DECREF`。"
729743
730- #: ../../c-api/module.rst:551
744+ #: ../../c-api/module.rst:559
731745msgid ""
732746"static int\n"
733747"add_spam(PyObject *module, int value)\n"
@@ -746,7 +760,7 @@ msgid ""
746760"}"
747761msgstr ""
748762
749- #: ../../c-api/module.rst:570
763+ #: ../../c-api/module.rst:578
750764msgid ""
751765"static int\n"
752766"add_spam(PyObject *module, int value)\n"
@@ -762,7 +776,7 @@ msgid ""
762776"}"
763777msgstr ""
764778
765- #: ../../c-api/module.rst:589
779+ #: ../../c-api/module.rst:597
766780msgid ""
767781"Add an integer constant to *module* as *name*. This convenience function "
768782"can be used from the module's initialization function. Return ``-1`` with an"
@@ -771,7 +785,15 @@ msgstr ""
771785"将一个整数常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块的初始化函数中使用。 当发生错误时将返回 ``-1`` "
772786"并设置一个异常,成功时则返回 ``0``。"
773787
774- #: ../../c-api/module.rst:596
788+ #: ../../c-api/module.rst:601
789+ msgid ""
790+ "This is a convenience function that calls :c:func:`PyLong_FromLong` and "
791+ ":c:func:`PyModule_AddObjectRef`; see their documentation for details."
792+ msgstr ""
793+ "这是一个调用 :c:func:`PyLong_FromLong` 和 :c:func:`PyModule_AddObjectRef` "
794+ "的便捷函数;请参阅其文档了解详情。"
795+
796+ #: ../../c-api/module.rst:607
775797msgid ""
776798"Add a string constant to *module* as *name*. This convenience function can "
777799"be used from the module's initialization function. The string *value* must "
@@ -781,7 +803,16 @@ msgstr ""
781803"将一个字符串常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块初始化函数中使用。 字符串 *value* 必须以 "
782804"``NULL`` 结尾。 当发生错误时将返回 ``-1``,成功时则返回 ``0``。"
783805
784- #: ../../c-api/module.rst:604
806+ #: ../../c-api/module.rst:612
807+ msgid ""
808+ "This is a convenience function that calls "
809+ ":c:func:`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; "
810+ "see their documentation for details."
811+ msgstr ""
812+ "这是一个调用 :c:func:`PyUnicode_InternFromString` 和 "
813+ ":c:func:`PyModule_AddObjectRef` 的便捷函数;请参阅其文档了解详情。"
814+
815+ #: ../../c-api/module.rst:619
785816msgid ""
786817"Add an int constant to *module*. The name and the value are taken from "
787818"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
@@ -792,11 +823,11 @@ msgstr ""
792823"AF_INET)`` 将值为 *AF_INET* 的整数常量 *AF_INET* 添加到 *module* 中。 当发生错误时将抬 ``-1`` "
793824"并设置一个异常,成功时将返回 ``0``。"
794825
795- #: ../../c-api/module.rst:612
826+ #: ../../c-api/module.rst:627
796827msgid "Add a string constant to *module*."
797828msgstr "将一个字符串常量添加到*module*模块中。"
798829
799- #: ../../c-api/module.rst:616
830+ #: ../../c-api/module.rst:631
800831msgid ""
801832"Add a type object to *module*. The type object is finalized by calling "
802833"internally :c:func:`PyType_Ready`. The name of the type object is taken from"
@@ -807,25 +838,25 @@ msgstr ""
807838":c:member:`~PyTypeObject.tp_name` 在点号之后的部分。 当发生错误时将返回 ``-1`` 并设置一个异常,成功时将返回 "
808839"``0``。"
809840
810- #: ../../c-api/module.rst:626
841+ #: ../../c-api/module.rst:641
811842msgid "Module lookup"
812843msgstr "查找模块"
813844
814- #: ../../c-api/module.rst:628
845+ #: ../../c-api/module.rst:643
815846msgid ""
816847"Single-phase initialization creates singleton modules that can be looked up "
817848"in the context of the current interpreter. This allows the module object to "
818849"be retrieved later with only a reference to the module definition."
819850msgstr "单阶段初始化创建可以在当前解释器上下文中被查找的单例模块。这使得仅通过模块定义的引用,就可以检索模块对象。"
820851
821- #: ../../c-api/module.rst:632
852+ #: ../../c-api/module.rst:647
822853msgid ""
823854"These functions will not work on modules created using multi-phase "
824855"initialization, since multiple such modules can be created from a single "
825856"definition."
826857msgstr "这些函数不适用于通过多阶段初始化创建的模块,因为可以从一个模块定义创建多个模块对象。"
827858
828- #: ../../c-api/module.rst:637
859+ #: ../../c-api/module.rst:652
829860msgid ""
830861"Returns the module object that was created from *def* for the current "
831862"interpreter. This method requires that the module object has been attached "
@@ -836,18 +867,18 @@ msgstr ""
836867"返回当前解释器中由 *def* 创建的模块对象。此方法要求模块对象此前已通过 :c:func:`PyState_AddModule` "
837868"函数附加到解释器状态中。如果找不到相应的模块对象,或模块对象还未附加到解释器状态,返回 ``NULL``。"
838869
839- #: ../../c-api/module.rst:644
870+ #: ../../c-api/module.rst:659
840871msgid ""
841872"Attaches the module object passed to the function to the interpreter state. "
842873"This allows the module object to be accessible via "
843874":c:func:`PyState_FindModule`."
844875msgstr "将传给函数的模块对象附加到解释器状态。 这将允许通过 :c:func:`PyState_FindModule` 来访问该模块对象。"
845876
846- #: ../../c-api/module.rst:647
877+ #: ../../c-api/module.rst:662
847878msgid "Only effective on modules created using single-phase initialization."
848879msgstr "仅在使用单阶段初始化创建的模块上有效。"
849880
850- #: ../../c-api/module.rst:649
881+ #: ../../c-api/module.rst:664
851882msgid ""
852883"Python calls ``PyState_AddModule`` automatically after importing a module, "
853884"so it is unnecessary (but harmless) to call it from module initialization "
@@ -861,15 +892,15 @@ msgstr ""
861892"显式的调用仅在模块自己的初始化代码后继调用了 ``PyState_FindModule`` 的情况下才是必要的。 "
862893"此函数主要是为了实现替代导入机制(或是通过直接调用它,或是通过引用它的实现来获取所需的状态更新详情)。"
863894
864- #: ../../c-api/module.rst:657 ../../c-api/module.rst:668
895+ #: ../../c-api/module.rst:672 ../../c-api/module.rst:683
865896msgid "The caller must hold the GIL."
866897msgstr "调用时必须携带GIL。"
867898
868- #: ../../c-api/module.rst:659
899+ #: ../../c-api/module.rst:674
869900msgid "Return ``-1`` with an exception set on error, ``0`` on success."
870901msgstr "出错时返回 ``-1`` 并设置一个异常,成功时返回 ``0``。"
871902
872- #: ../../c-api/module.rst:665
903+ #: ../../c-api/module.rst:680
873904msgid ""
874905"Removes the module object created from *def* from the interpreter state. "
875906"Return ``-1`` with an exception set on error, ``0`` on success."
0 commit comments