@@ -18,7 +18,7 @@ msgid ""
1818msgstr ""
1919"Project-Id-Version : Python 3.12\n "
2020"Report-Msgid-Bugs-To : \n "
21- "POT-Creation-Date : 2023-07-29 02:08 +0000\n "
21+ "POT-Creation-Date : 2023-08-04 14:13 +0000\n "
2222"PO-Revision-Date : 2021-06-28 00:49+0000\n "
2323"
Last-Translator :
Freesand Leo <[email protected] >, 2023\n "
2424"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -494,15 +494,56 @@ msgid ""
494494"order they appear in the *m_slots* array."
495495msgstr "如果指定了多个 ``Py_mod_exec`` 槽位,将按照它们在*m_slots*数组中出现的顺序进行处理。"
496496
497- #: ../../c-api/module.rst:379
497+ #: ../../c-api/module.rst:381
498+ msgid "Specifies one of the following values:"
499+ msgstr "指定以下的值之一:"
500+
501+ #: ../../c-api/module.rst:385
502+ msgid "The module does not support being imported in subinterpreters."
503+ msgstr "该模块不支持在子解释器中导入。"
504+
505+ #: ../../c-api/module.rst:389
506+ msgid ""
507+ "The module supports being imported in subinterpreters, but only when they "
508+ "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)"
509+ msgstr ""
510+ "该模块支持在子解释器中导入,但是它们必须要共享主解释器的 GIL。 (参见 :ref:`isolating-extensions-howto`。)"
511+
512+ #: ../../c-api/module.rst:395
513+ msgid ""
514+ "The module supports being imported in subinterpreters, even when they have "
515+ "their own GIL. (See :ref:`isolating-extensions-howto`.)"
516+ msgstr "该模块支持在子解释器中导入,即使它们有自己的 GIL。 (参见 :ref:`isolating-extensions-howto`。)"
517+
518+ #: ../../c-api/module.rst:399
519+ msgid ""
520+ "This slot determines whether or not importing this module in a "
521+ "subinterpreter will fail."
522+ msgstr "此槽位决定在子解释器中导入此模块是否会失败。"
523+
524+ #: ../../c-api/module.rst:402
525+ msgid ""
526+ "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one "
527+ "module definition."
528+ msgstr "在一个模块定义中不能指定多个 ``Py_mod_multiple_interpreters`` 槽位。"
529+
530+ #: ../../c-api/module.rst:405
531+ msgid ""
532+ "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery "
533+ "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``."
534+ msgstr ""
535+ "如果未指定 ``Py_mod_multiple_interpreters``,则导入机制默认为 "
536+ "``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``。"
537+
538+ #: ../../c-api/module.rst:410
498539msgid "See :PEP:`489` for more details on multi-phase initialization."
499540msgstr "有关多阶段初始化的更多细节,请参阅PEP:`489`"
500541
501- #: ../../c-api/module.rst:382
542+ #: ../../c-api/module.rst:413
502543msgid "Low-level module creation functions"
503544msgstr "底层模块创建函数"
504545
505- #: ../../c-api/module.rst:384
546+ #: ../../c-api/module.rst:415
506547msgid ""
507548"The following functions are called under the hood when using multi-phase "
508549"initialization. They can be used directly, for example when creating module "
@@ -512,7 +553,7 @@ msgstr ""
512553"当使用多阶段初始化时,将会调用以下函数。例如,在动态创建模块对象的时候,可以直接使用它们。注意,必须调用 "
513554"``PyModule_FromDefAndSpec`` 和 ``PyModule_ExecDef`` 来完整地初始化一个模块。"
514555
515- #: ../../c-api/module.rst:391
556+ #: ../../c-api/module.rst:422
516557msgid ""
517558"Create a new module object, given the definition in *def* and the ModuleSpec"
518559" *spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with "
@@ -522,7 +563,7 @@ msgstr ""
522563":c:func:`PyModule_FromDefAndSpec2` 将 *module_api_version* 设为 "
523564":c:macro:`PYTHON_API_VERSION`。"
524565
525- #: ../../c-api/module.rst:399
566+ #: ../../c-api/module.rst:430
526567msgid ""
527568"Create a new module object, given the definition in *def* and the ModuleSpec"
528569" *spec*, assuming the API version *module_api_version*. If that version does"
@@ -532,17 +573,17 @@ msgstr ""
532573"创建一个新的模块对象,在参数 *def* 和 *spec* 中给出定义,设置API版本为参数 "
533574"*module_api_version*。如果该版本与正在运行的解释器版本不匹配,则会触发 :exc:`RuntimeWarning`。"
534575
535- #: ../../c-api/module.rst:406
576+ #: ../../c-api/module.rst:437
536577msgid ""
537578"Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`"
538579" instead; only use this if you are sure you need it."
539580msgstr "大多数时候应该使用 :c:func:`PyModule_FromDefAndSpec` 代替使用此函数,除非你确定需要使用它。"
540581
541- #: ../../c-api/module.rst:413
582+ #: ../../c-api/module.rst:444
542583msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*."
543584msgstr "执行参数*def*中给出的任意执行槽(:c:data:`Py_mod_exec`)。"
544585
545- #: ../../c-api/module.rst:419
586+ #: ../../c-api/module.rst:450
546587msgid ""
547588"Set the docstring for *module* to *docstring*. This function is called "
548589"automatically when creating a module from ``PyModuleDef``, using either "
@@ -551,7 +592,7 @@ msgstr ""
551592"将*module*的文档字符串设置为*docstring*。当使用 ``PyModule_Create`` 或 "
552593"``PyModule_FromDefAndSpec`` 从 ``PyModuleDef`` 创建模块时,会自动调用此函数。"
553594
554- #: ../../c-api/module.rst:428
595+ #: ../../c-api/module.rst:459
555596msgid ""
556597"Add the functions from the ``NULL`` terminated *functions* array to "
557598"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on "
@@ -568,60 +609,60 @@ msgstr ""
568609"``PyModule_Create`` 或 ``PyModule_FromDefAndSpec`` 从 ``PyModuleDef`` "
569610"创建模块时,会自动调用此函数。"
570611
571- #: ../../c-api/module.rst:440
612+ #: ../../c-api/module.rst:471
572613msgid "Support functions"
573614msgstr "支持函数"
574615
575- #: ../../c-api/module.rst:442
616+ #: ../../c-api/module.rst:473
576617msgid ""
577618"The module initialization function (if using single phase initialization) or"
578619" a function called from a module execution slot (if using multi-phase "
579620"initialization), can use the following functions to help initialize the "
580621"module state:"
581622msgstr "模块初始化函数(单阶段初始化)或通过模块的执行槽位调用的函数(多阶段初始化),可以使用以下函数,来帮助初始化模块的状态:"
582623
583- #: ../../c-api/module.rst:449
624+ #: ../../c-api/module.rst:480
584625msgid ""
585626"Add an object to *module* as *name*. This is a convenience function which "
586627"can be used from the module's initialization function."
587628msgstr "将一个名称为*name*的对象添加到*module*模块中。这是一个方便的函数,可以在模块的初始化函数中使用。"
588629
589- #: ../../c-api/module.rst:452
630+ #: ../../c-api/module.rst:483
590631msgid ""
591632"On success, return ``0``. On error, raise an exception and return ``-1``."
592633msgstr "如果成功,返回 ``0``。如果发生错误,引发异常并返回 ``-1``。"
593634
594- #: ../../c-api/module.rst:454
635+ #: ../../c-api/module.rst:485
595636msgid ""
596637"Return ``NULL`` if *value* is ``NULL``. It must be called with an exception "
597638"raised in this case."
598639msgstr "如果*value*为 ``NULL``,返回 ``NULL``。在调用它时发生这种情况,必须抛出异常。"
599640
600- #: ../../c-api/module.rst:457 ../../c-api/module.rst:506
641+ #: ../../c-api/module.rst:488 ../../c-api/module.rst:537
601642msgid "Example usage::"
602643msgstr "用法示例:"
603644
604- #: ../../c-api/module.rst:471 ../../c-api/module.rst:524
645+ #: ../../c-api/module.rst:502 ../../c-api/module.rst:555
605646msgid ""
606647"The example can also be written without checking explicitly if *obj* is "
607648"``NULL``::"
608649msgstr "这个例子也可以写成不显式地检查 *obj* 是否为 ``NULL``::"
609650
610- #: ../../c-api/module.rst:483 ../../c-api/module.rst:540
651+ #: ../../c-api/module.rst:514 ../../c-api/module.rst:571
611652msgid ""
612653"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this"
613654" case, since *obj* can be ``NULL``."
614655msgstr ""
615656"注意在此情况下应当使用 ``Py_XDECREF()`` 而不是 ``Py_DECREF()``,因为 *obj* 可能为 ``NULL``。"
616657
617- #: ../../c-api/module.rst:491
658+ #: ../../c-api/module.rst:522
618659msgid ""
619660"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
620661"*value* on success (if it returns ``0``)."
621662msgstr ""
622663"类似于 :c:func:`PyModule_AddObjectRef`,但会在成功时偷取一个对 *value* 的引用(如果它返回 ``0`` 值)。"
623664
624- #: ../../c-api/module.rst:494
665+ #: ../../c-api/module.rst:525
625666msgid ""
626667"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is"
627668" easy to introduce reference leaks by misusing the "
@@ -630,19 +671,19 @@ msgstr ""
630671"推荐使用新的 :c:func:`PyModule_AddObjectRef` 函数,因为误用 :c:func:`PyModule_AddObject` "
631672"函数很容易导致引用泄漏。"
632673
633- #: ../../c-api/module.rst:500
674+ #: ../../c-api/module.rst:531
634675msgid ""
635676"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
636677"decrements the reference count of *value* **on success**."
637678msgstr "和其它窃取引用的函数不同,``PyModule_AddObject()`` 只在**成功**时减少*value*的引用计数。"
638679
639- #: ../../c-api/module.rst:503
680+ #: ../../c-api/module.rst:534
640681msgid ""
641682"This means that its return value must be checked, and calling code must "
642683":c:func:`Py_DECREF` *value* manually on error."
643684msgstr "这意味着必须检查它的返回值,调用方必须在发生错误时手动为*value*调用 :c:func:`Py_DECREF`。"
644685
645- #: ../../c-api/module.rst:546
686+ #: ../../c-api/module.rst:577
646687msgid ""
647688"Add an integer constant to *module* as *name*. This convenience function "
648689"can be used from the module's initialization function. Return ``-1`` on "
@@ -651,7 +692,7 @@ msgstr ""
651692"将一个名称为*name*的整型常量添加到*module*模块中。这个方便的函数可以在模块的初始化函数中使用。如果发生错误,返回 ``-1``,成功返回 "
652693"``0``。"
653694
654- #: ../../c-api/module.rst:553
695+ #: ../../c-api/module.rst:584
655696msgid ""
656697"Add a string constant to *module* as *name*. This convenience function can "
657698"be used from the module's initialization function. The string *value* must "
@@ -660,7 +701,7 @@ msgstr ""
660701"将一个名称为*name*的字符串常量添加到*module*模块中。这个方便的函数可以在模块的初始化函数中使用。字符串*value*必须以 "
661702"``NULL`` 结尾。如果发生错误,返回 ``-1`` ,成功返回 ``0`` 。"
662703
663- #: ../../c-api/module.rst:560
704+ #: ../../c-api/module.rst:591
664705msgid ""
665706"Add an int constant to *module*. The name and the value are taken from "
666707"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
@@ -671,11 +712,11 @@ msgstr ""
671712"AF_INET)`` 将值为*AF_INET*的整型常量*AF_INET*添加到*module*模块中。如果发生错误,返回 ``-1`` ,成功返回 "
672713"``0`` 。"
673714
674- #: ../../c-api/module.rst:568
715+ #: ../../c-api/module.rst:599
675716msgid "Add a string constant to *module*."
676717msgstr "将一个字符串常量添加到*module*模块中。"
677718
678- #: ../../c-api/module.rst:572
719+ #: ../../c-api/module.rst:603
679720msgid ""
680721"Add a type object to *module*. The type object is finalized by calling "
681722"internally :c:func:`PyType_Ready`. The name of the type object is taken from"
@@ -685,25 +726,25 @@ msgstr ""
685726"将一个类型对象添加到 *module* 模块中。类型对象通过在函数内部调用 :c:func:`PyType_Ready` 完成初始化。类型对象的名称取自"
686727" :c:member:`~PyTypeObject.tp_name` 最后一个点号之后的部分。如果发生错误,返回 ``-1``,成功返回 ``0``。"
687728
688- #: ../../c-api/module.rst:582
729+ #: ../../c-api/module.rst:613
689730msgid "Module lookup"
690731msgstr "查找模块"
691732
692- #: ../../c-api/module.rst:584
733+ #: ../../c-api/module.rst:615
693734msgid ""
694735"Single-phase initialization creates singleton modules that can be looked up "
695736"in the context of the current interpreter. This allows the module object to "
696737"be retrieved later with only a reference to the module definition."
697738msgstr "单阶段初始化创建可以在当前解释器上下文中被查找的单例模块。这使得仅通过模块定义的引用,就可以检索模块对象。"
698739
699- #: ../../c-api/module.rst:588
740+ #: ../../c-api/module.rst:619
700741msgid ""
701742"These functions will not work on modules created using multi-phase "
702743"initialization, since multiple such modules can be created from a single "
703744"definition."
704745msgstr "这些函数不适用于通过多阶段初始化创建的模块,因为可以从一个模块定义创建多个模块对象。"
705746
706- #: ../../c-api/module.rst:593
747+ #: ../../c-api/module.rst:624
707748msgid ""
708749"Returns the module object that was created from *def* for the current "
709750"interpreter. This method requires that the module object has been attached "
@@ -714,18 +755,18 @@ msgstr ""
714755"返回当前解释器中由 *def* 创建的模块对象。此方法要求模块对象此前已通过 :c:func:`PyState_AddModule` "
715756"函数附加到解释器状态中。如果找不到相应的模块对象,或模块对象还未附加到解释器状态,返回 ``NULL``。"
716757
717- #: ../../c-api/module.rst:600
758+ #: ../../c-api/module.rst:631
718759msgid ""
719760"Attaches the module object passed to the function to the interpreter state. "
720761"This allows the module object to be accessible via "
721762":c:func:`PyState_FindModule`."
722763msgstr "将传给函数的模块对象附加到解释器状态。 这将允许通过 :c:func:`PyState_FindModule` 来访问该模块对象。"
723764
724- #: ../../c-api/module.rst:603
765+ #: ../../c-api/module.rst:634
725766msgid "Only effective on modules created using single-phase initialization."
726767msgstr "仅在使用单阶段初始化创建的模块上有效。"
727768
728- #: ../../c-api/module.rst:605
769+ #: ../../c-api/module.rst:636
729770msgid ""
730771"Python calls ``PyState_AddModule`` automatically after importing a module, "
731772"so it is unnecessary (but harmless) to call it from module initialization "
@@ -739,15 +780,15 @@ msgstr ""
739780"显式的调用仅在模块自己的初始化代码后继调用了 ``PyState_FindModule`` 的情况下才是必要的。 "
740781"此函数主要是为了实现替代导入机制(或是通过直接调用它,或是通过引用它的实现来获取所需的状态更新详情)。"
741782
742- #: ../../c-api/module.rst:613 ../../c-api/module.rst:624
783+ #: ../../c-api/module.rst:644 ../../c-api/module.rst:655
743784msgid "The caller must hold the GIL."
744785msgstr "调用时必须携带GIL。"
745786
746- #: ../../c-api/module.rst:615
787+ #: ../../c-api/module.rst:646
747788msgid "Return 0 on success or -1 on failure."
748789msgstr "成功是返回 0 或者失败时返回 -1。"
749790
750- #: ../../c-api/module.rst:621
791+ #: ../../c-api/module.rst:652
751792msgid ""
752793"Removes the module object created from *def* from the interpreter state. "
753794"Return 0 on success or -1 on failure."
0 commit comments