1
1
# SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2001-2024 , Python Software Foundation
2
+ # Copyright (C) 2001-2025 , Python Software Foundation
3
3
# This file is distributed under the same license as the Python package.
4
4
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
#
@@ -11,7 +11,7 @@ msgid ""
11
11
msgstr ""
12
12
"Project-Id-Version : Python 3.12\n "
13
13
"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 "
15
15
"PO-Revision-Date : 2024-05-11 00:32+0000\n "
16
16
"Last-Translator : Rafael Fontenelle <rffontenelle@gmail.com>, 2024\n "
17
17
"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -635,17 +635,11 @@ msgid ""
635
635
"On success, return ``0``. On error, raise an exception and return ``-1``."
636
636
msgstr "如果成功,返回 ``0``。如果发生错误,引发异常并返回 ``-1``。"
637
637
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
645
639
msgid "Example usage::"
646
640
msgstr "用法示例::"
647
641
648
- #: ../../c-api/module.rst:504
642
+ #: ../../c-api/module.rst:501
649
643
msgid ""
650
644
"static int\n"
651
645
"add_spam(PyObject *module, int value)\n"
@@ -671,13 +665,20 @@ msgstr ""
671
665
" return res;\n"
672
666
" }"
673
667
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
675
676
msgid ""
676
677
"The example can also be written without checking explicitly if *obj* is "
677
678
"``NULL``::"
678
679
msgstr "这个例子也可以写成不显式地检查 *obj* 是否为 ``NULL``::"
679
680
680
- #: ../../c-api/module.rst:519
681
+ #: ../../c-api/module.rst:520
681
682
msgid ""
682
683
"static int\n"
683
684
"add_spam(PyObject *module, int value)\n"
@@ -697,14 +698,14 @@ msgstr ""
697
698
" return res;\n"
698
699
" }"
699
700
700
- #: ../../c-api/module.rst:528 ../../c-api/module.rst:593
701
+ #: ../../c-api/module.rst:529 ../../c-api/module.rst:594
701
702
msgid ""
702
703
"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this"
703
704
" case, since *obj* can be ``NULL``."
704
705
msgstr ""
705
706
"注意在此情况下应当使用 ``Py_XDECREF()`` 而不是 ``Py_DECREF()``,因为 *obj* 可能为 ``NULL``。"
706
707
707
- #: ../../c-api/module.rst:531
708
+ #: ../../c-api/module.rst:532
708
709
msgid ""
709
710
"The number of different *name* strings passed to this function should be "
710
711
"kept small, usually by only using statically allocated strings as *name*. "
@@ -718,14 +719,14 @@ msgstr ""
718
719
":c:func:`PyObject_SetAttr`。 更多相关细节,请参阅 "
719
720
":c:func:`PyUnicode_InternFromString`,它可在内部用于创建键对象。"
720
721
721
- #: ../../c-api/module.rst:544
722
+ #: ../../c-api/module.rst:545
722
723
msgid ""
723
724
"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
724
725
"*value* on success (if it returns ``0``)."
725
726
msgstr ""
726
727
"类似于 :c:func:`PyModule_AddObjectRef`,但会在成功时偷取一个对 *value* 的引用(如果它返回 ``0`` 值)。"
727
728
728
- #: ../../c-api/module.rst:547
729
+ #: ../../c-api/module.rst:548
729
730
msgid ""
730
731
"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is"
731
732
" easy to introduce reference leaks by misusing the "
@@ -734,19 +735,19 @@ msgstr ""
734
735
"推荐使用新的 :c:func:`PyModule_AddObjectRef` 函数,因为误用 :c:func:`PyModule_AddObject` "
735
736
"函数很容易导致引用泄漏。"
736
737
737
- #: ../../c-api/module.rst:553
738
+ #: ../../c-api/module.rst:554
738
739
msgid ""
739
740
"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
740
741
"releases the reference to *value* **on success**."
741
742
msgstr "与其他窃取引用的函数不同,``PyModule_AddObject()`` 只在 **成功** 时释放对 *value* 的引用。"
742
743
743
- #: ../../c-api/module.rst:556
744
+ #: ../../c-api/module.rst:557
744
745
msgid ""
745
746
"This means that its return value must be checked, and calling code must "
746
747
":c:func:`Py_DECREF` *value* manually on error."
747
748
msgstr "这意味着必须检查它的返回值,调用方必须在发生错误时手动为*value*调用 :c:func:`Py_DECREF`。"
748
749
749
- #: ../../c-api/module.rst:561
750
+ #: ../../c-api/module.rst:562
750
751
msgid ""
751
752
"static int\n"
752
753
"add_spam(PyObject *module, int value)\n"
@@ -765,7 +766,7 @@ msgid ""
765
766
"}"
766
767
msgstr ""
767
768
768
- #: ../../c-api/module.rst:580
769
+ #: ../../c-api/module.rst:581
769
770
msgid ""
770
771
"static int\n"
771
772
"add_spam(PyObject *module, int value)\n"
@@ -781,7 +782,7 @@ msgid ""
781
782
"}"
782
783
msgstr ""
783
784
784
- #: ../../c-api/module.rst:599
785
+ #: ../../c-api/module.rst:600
785
786
msgid ""
786
787
"Add an integer constant to *module* as *name*. This convenience function "
787
788
"can be used from the module's initialization function. Return ``-1`` with an"
@@ -790,15 +791,15 @@ msgstr ""
790
791
"将一个整数常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块的初始化函数中使用。 当发生错误时将返回 ``-1`` "
791
792
"并设置一个异常,成功时则返回 ``0``。"
792
793
793
- #: ../../c-api/module.rst:603
794
+ #: ../../c-api/module.rst:604
794
795
msgid ""
795
796
"This is a convenience function that calls :c:func:`PyLong_FromLong` and "
796
797
":c:func:`PyModule_AddObjectRef`; see their documentation for details."
797
798
msgstr ""
798
799
"这是一个调用 :c:func:`PyLong_FromLong` 和 :c:func:`PyModule_AddObjectRef` "
799
800
"的便捷函数;请参阅其文档了解详情。"
800
801
801
- #: ../../c-api/module.rst:609
802
+ #: ../../c-api/module.rst:610
802
803
msgid ""
803
804
"Add a string constant to *module* as *name*. This convenience function can "
804
805
"be used from the module's initialization function. The string *value* must "
@@ -808,7 +809,7 @@ msgstr ""
808
809
"将一个字符串常量作为 *name* 添加到 *module* 中。 这个便捷函数可在模块初始化函数中使用。 字符串 *value* 必须以 "
809
810
"``NULL`` 结尾。 当发生错误时将返回 ``-1``,成功时则返回 ``0``。"
810
811
811
- #: ../../c-api/module.rst:614
812
+ #: ../../c-api/module.rst:615
812
813
msgid ""
813
814
"This is a convenience function that calls "
814
815
":c:func:`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; "
@@ -817,7 +818,7 @@ msgstr ""
817
818
"这是一个调用 :c:func:`PyUnicode_InternFromString` 和 "
818
819
":c:func:`PyModule_AddObjectRef` 的便捷函数;请参阅其文档了解详情。"
819
820
820
- #: ../../c-api/module.rst:621
821
+ #: ../../c-api/module.rst:622
821
822
msgid ""
822
823
"Add an int constant to *module*. The name and the value are taken from "
823
824
"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
@@ -828,11 +829,11 @@ msgstr ""
828
829
"AF_INET)`` 将值为 *AF_INET* 的整数常量 *AF_INET* 添加到 *module* 中。 当发生错误时将抬 ``-1`` "
829
830
"并设置一个异常,成功时将返回 ``0``。"
830
831
831
- #: ../../c-api/module.rst:629
832
+ #: ../../c-api/module.rst:630
832
833
msgid "Add a string constant to *module*."
833
834
msgstr "将一个字符串常量添加到*module*模块中。"
834
835
835
- #: ../../c-api/module.rst:633
836
+ #: ../../c-api/module.rst:634
836
837
msgid ""
837
838
"Add a type object to *module*. The type object is finalized by calling "
838
839
"internally :c:func:`PyType_Ready`. The name of the type object is taken from"
@@ -843,25 +844,25 @@ msgstr ""
843
844
":c:member:`~PyTypeObject.tp_name` 在点号之后的部分。 当发生错误时将返回 ``-1`` 并设置一个异常,成功时将返回 "
844
845
"``0``。"
845
846
846
- #: ../../c-api/module.rst:643
847
+ #: ../../c-api/module.rst:644
847
848
msgid "Module lookup"
848
849
msgstr "查找模块"
849
850
850
- #: ../../c-api/module.rst:645
851
+ #: ../../c-api/module.rst:646
851
852
msgid ""
852
853
"Single-phase initialization creates singleton modules that can be looked up "
853
854
"in the context of the current interpreter. This allows the module object to "
854
855
"be retrieved later with only a reference to the module definition."
855
856
msgstr "单阶段初始化创建可以在当前解释器上下文中被查找的单例模块。这使得仅通过模块定义的引用,就可以检索模块对象。"
856
857
857
- #: ../../c-api/module.rst:649
858
+ #: ../../c-api/module.rst:650
858
859
msgid ""
859
860
"These functions will not work on modules created using multi-phase "
860
861
"initialization, since multiple such modules can be created from a single "
861
862
"definition."
862
863
msgstr "这些函数不适用于通过多阶段初始化创建的模块,因为可以从一个模块定义创建多个模块对象。"
863
864
864
- #: ../../c-api/module.rst:654
865
+ #: ../../c-api/module.rst:655
865
866
msgid ""
866
867
"Returns the module object that was created from *def* for the current "
867
868
"interpreter. This method requires that the module object has been attached "
@@ -872,18 +873,18 @@ msgstr ""
872
873
"返回当前解释器中由 *def* 创建的模块对象。此方法要求模块对象此前已通过 :c:func:`PyState_AddModule` "
873
874
"函数附加到解释器状态中。如果找不到相应的模块对象,或模块对象还未附加到解释器状态,返回 ``NULL``。"
874
875
875
- #: ../../c-api/module.rst:661
876
+ #: ../../c-api/module.rst:662
876
877
msgid ""
877
878
"Attaches the module object passed to the function to the interpreter state. "
878
879
"This allows the module object to be accessible via "
879
880
":c:func:`PyState_FindModule`."
880
881
msgstr "将传给函数的模块对象附加到解释器状态。 这将允许通过 :c:func:`PyState_FindModule` 来访问该模块对象。"
881
882
882
- #: ../../c-api/module.rst:664
883
+ #: ../../c-api/module.rst:665
883
884
msgid "Only effective on modules created using single-phase initialization."
884
885
msgstr "仅在使用单阶段初始化创建的模块上有效。"
885
886
886
- #: ../../c-api/module.rst:666
887
+ #: ../../c-api/module.rst:667
887
888
msgid ""
888
889
"Python calls ``PyState_AddModule`` automatically after importing a module, "
889
890
"so it is unnecessary (but harmless) to call it from module initialization "
@@ -897,15 +898,15 @@ msgstr ""
897
898
"显式的调用仅在模块自己的初始化代码后继调用了 ``PyState_FindModule`` 的情况下才是必要的。 "
898
899
"此函数主要是为了实现替代导入机制(或是通过直接调用它,或是通过引用它的实现来获取所需的状态更新详情)。"
899
900
900
- #: ../../c-api/module.rst:674 ../../c-api/module.rst:685
901
+ #: ../../c-api/module.rst:675 ../../c-api/module.rst:686
901
902
msgid "The caller must hold the GIL."
902
903
msgstr "调用时必须携带GIL。"
903
904
904
- #: ../../c-api/module.rst:676
905
+ #: ../../c-api/module.rst:677
905
906
msgid "Return ``-1`` with an exception set on error, ``0`` on success."
906
907
msgstr "出错时返回 ``-1`` 并设置一个异常,成功时返回 ``0``。"
907
908
908
- #: ../../c-api/module.rst:682
909
+ #: ../../c-api/module.rst:683
909
910
msgid ""
910
911
"Removes the module object created from *def* from the interpreter state. "
911
912
"Return ``-1`` with an exception set on error, ``0`` on success."
0 commit comments