7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.13\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
- "POT-Creation-Date : 2024-10-10 00:13+0000\n "
10
+ "POT-Creation-Date : 2025-02-04 00:13+0000\n "
11
11
"PO-Revision-Date : 2018-05-23 14:32+0000\n "
12
12
"
Last-Translator :
Adrian Liaw <[email protected] >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -584,18 +584,12 @@ msgid ""
584
584
"On success, return ``0``. On error, raise an exception and return ``-1``."
585
585
msgstr ""
586
586
587
- #: ../../c-api/module.rst:526
588
- msgid ""
589
- "Return ``-1`` if *value* is ``NULL``. It must be called with an exception "
590
- "raised in this case."
591
- msgstr ""
592
-
593
- #: ../../c-api/module.rst:529 ../../c-api/module.rst:576
594
- #: ../../c-api/module.rst:603
587
+ #: ../../c-api/module.rst:526 ../../c-api/module.rst:577
588
+ #: ../../c-api/module.rst:604
595
589
msgid "Example usage::"
596
590
msgstr "用法範例: ::"
597
591
598
- #: ../../c-api/module.rst:531
592
+ #: ../../c-api/module.rst:528
599
593
msgid ""
600
594
"static int\n"
601
595
"add_spam(PyObject *module, int value)\n"
@@ -621,13 +615,20 @@ msgstr ""
621
615
" return res;\n"
622
616
" }"
623
617
624
- #: ../../c-api/module.rst:543
618
+ #: ../../c-api/module.rst:540
619
+ msgid ""
620
+ "To be convenient, the function accepts ``NULL`` *value* with an exception "
621
+ "set. In this case, return ``-1`` and just leave the raised exception "
622
+ "unchanged."
623
+ msgstr ""
624
+
625
+ #: ../../c-api/module.rst:544
625
626
msgid ""
626
627
"The example can also be written without checking explicitly if *obj* is "
627
628
"``NULL``::"
628
629
msgstr ""
629
630
630
- #: ../../c-api/module.rst:546
631
+ #: ../../c-api/module.rst:547
631
632
msgid ""
632
633
"static int\n"
633
634
"add_spam(PyObject *module, int value)\n"
@@ -647,13 +648,13 @@ msgstr ""
647
648
" return res;\n"
648
649
" }"
649
650
650
- #: ../../c-api/module.rst:555
651
+ #: ../../c-api/module.rst:556
651
652
msgid ""
652
653
"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this "
653
654
"case, since *obj* can be ``NULL``."
654
655
msgstr ""
655
656
656
- #: ../../c-api/module.rst:558
657
+ #: ../../c-api/module.rst:559
657
658
msgid ""
658
659
"The number of different *name* strings passed to this function should be "
659
660
"kept small, usually by only using statically allocated strings as *name*. "
@@ -663,47 +664,47 @@ msgid ""
663
664
"internally to create a key object."
664
665
msgstr ""
665
666
666
- #: ../../c-api/module.rst:571
667
+ #: ../../c-api/module.rst:572
667
668
msgid ""
668
669
"Similar to :c:func:`PyModule_AddObjectRef`, but \" steals\" a reference to "
669
670
"*value*. It can be called with a result of function that returns a new "
670
671
"reference without bothering to check its result or even saving it to a "
671
672
"variable."
672
673
msgstr ""
673
674
674
- #: ../../c-api/module.rst:578
675
+ #: ../../c-api/module.rst:579
675
676
msgid ""
676
677
"if (PyModule_Add(module, \" spam\" , PyBytes_FromString(value)) < 0) {\n"
677
678
" goto error;\n"
678
679
"}"
679
680
msgstr ""
680
681
681
- #: ../../c-api/module.rst:587
682
+ #: ../../c-api/module.rst:588
682
683
msgid ""
683
684
"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
684
685
"*value* on success (if it returns ``0``)."
685
686
msgstr ""
686
687
687
- #: ../../c-api/module.rst:590
688
+ #: ../../c-api/module.rst:591
688
689
msgid ""
689
690
"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions "
690
691
"are recommended, since it is easy to introduce reference leaks by misusing "
691
692
"the :c:func:`PyModule_AddObject` function."
692
693
msgstr ""
693
694
694
- #: ../../c-api/module.rst:597
695
+ #: ../../c-api/module.rst:598
695
696
msgid ""
696
697
"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
697
698
"releases the reference to *value* **on success**."
698
699
msgstr ""
699
700
700
- #: ../../c-api/module.rst:600
701
+ #: ../../c-api/module.rst:601
701
702
msgid ""
702
703
"This means that its return value must be checked, and calling code must :c:"
703
704
"func:`Py_XDECREF` *value* manually on error."
704
705
msgstr ""
705
706
706
- #: ../../c-api/module.rst:605
707
+ #: ../../c-api/module.rst:606
707
708
msgid ""
708
709
"PyObject *obj = PyBytes_FromString(value);\n"
709
710
"if (PyModule_AddObject(module, \" spam\" , obj) < 0) {\n"
@@ -717,59 +718,59 @@ msgid ""
717
718
"// Py_XDECREF(obj) is not needed here."
718
719
msgstr ""
719
720
720
- #: ../../c-api/module.rst:618
721
+ #: ../../c-api/module.rst:619
721
722
msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`."
722
723
msgstr ""
723
724
724
- #: ../../c-api/module.rst:623
725
+ #: ../../c-api/module.rst:624
725
726
msgid ""
726
727
"Add an integer constant to *module* as *name*. This convenience function "
727
728
"can be used from the module's initialization function. Return ``-1`` with an "
728
729
"exception set on error, ``0`` on success."
729
730
msgstr ""
730
731
731
- #: ../../c-api/module.rst:627
732
+ #: ../../c-api/module.rst:628
732
733
msgid ""
733
734
"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:"
734
735
"func:`PyModule_AddObjectRef`; see their documentation for details."
735
736
msgstr ""
736
737
737
- #: ../../c-api/module.rst:633
738
+ #: ../../c-api/module.rst:634
738
739
msgid ""
739
740
"Add a string constant to *module* as *name*. This convenience function can "
740
741
"be used from the module's initialization function. The string *value* must "
741
742
"be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` "
742
743
"on success."
743
744
msgstr ""
744
745
745
- #: ../../c-api/module.rst:638
746
+ #: ../../c-api/module.rst:639
746
747
msgid ""
747
748
"This is a convenience function that calls :c:func:"
748
749
"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their "
749
750
"documentation for details."
750
751
msgstr ""
751
752
752
- #: ../../c-api/module.rst:645
753
+ #: ../../c-api/module.rst:646
753
754
msgid ""
754
755
"Add an int constant to *module*. The name and the value are taken from "
755
756
"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
756
757
"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` "
757
758
"with an exception set on error, ``0`` on success."
758
759
msgstr ""
759
760
760
- #: ../../c-api/module.rst:653
761
+ #: ../../c-api/module.rst:654
761
762
msgid "Add a string constant to *module*."
762
763
msgstr ""
763
764
764
- #: ../../c-api/module.rst:657
765
+ #: ../../c-api/module.rst:658
765
766
msgid ""
766
767
"Add a type object to *module*. The type object is finalized by calling "
767
768
"internally :c:func:`PyType_Ready`. The name of the type object is taken from "
768
769
"the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return "
769
770
"``-1`` with an exception set on error, ``0`` on success."
770
771
msgstr ""
771
772
772
- #: ../../c-api/module.rst:667
773
+ #: ../../c-api/module.rst:668
773
774
msgid ""
774
775
"Indicate that *module* does or does not support running without the global "
775
776
"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. "
@@ -780,25 +781,25 @@ msgid ""
780
781
"Return ``-1`` with an exception set on error, ``0`` on success."
781
782
msgstr ""
782
783
783
- #: ../../c-api/module.rst:680
784
+ #: ../../c-api/module.rst:681
784
785
msgid "Module lookup"
785
786
msgstr "模組查找"
786
787
787
- #: ../../c-api/module.rst:682
788
+ #: ../../c-api/module.rst:683
788
789
msgid ""
789
790
"Single-phase initialization creates singleton modules that can be looked up "
790
791
"in the context of the current interpreter. This allows the module object to "
791
792
"be retrieved later with only a reference to the module definition."
792
793
msgstr ""
793
794
794
- #: ../../c-api/module.rst:686
795
+ #: ../../c-api/module.rst:687
795
796
msgid ""
796
797
"These functions will not work on modules created using multi-phase "
797
798
"initialization, since multiple such modules can be created from a single "
798
799
"definition."
799
800
msgstr ""
800
801
801
- #: ../../c-api/module.rst:691
802
+ #: ../../c-api/module.rst:692
802
803
msgid ""
803
804
"Returns the module object that was created from *def* for the current "
804
805
"interpreter. This method requires that the module object has been attached "
@@ -807,18 +808,18 @@ msgid ""
807
808
"to the interpreter state yet, it returns ``NULL``."
808
809
msgstr ""
809
810
810
- #: ../../c-api/module.rst:698
811
+ #: ../../c-api/module.rst:699
811
812
msgid ""
812
813
"Attaches the module object passed to the function to the interpreter state. "
813
814
"This allows the module object to be accessible via :c:func:"
814
815
"`PyState_FindModule`."
815
816
msgstr ""
816
817
817
- #: ../../c-api/module.rst:701
818
+ #: ../../c-api/module.rst:702
818
819
msgid "Only effective on modules created using single-phase initialization."
819
820
msgstr ""
820
821
821
- #: ../../c-api/module.rst:703
822
+ #: ../../c-api/module.rst:704
822
823
msgid ""
823
824
"Python calls ``PyState_AddModule`` automatically after importing a module, "
824
825
"so it is unnecessary (but harmless) to call it from module initialization "
@@ -829,15 +830,15 @@ msgid ""
829
830
"state updates)."
830
831
msgstr ""
831
832
832
- #: ../../c-api/module.rst:711 ../../c-api/module.rst:722
833
+ #: ../../c-api/module.rst:712 ../../c-api/module.rst:723
833
834
msgid "The caller must hold the GIL."
834
835
msgstr ""
835
836
836
- #: ../../c-api/module.rst:713
837
+ #: ../../c-api/module.rst:714
837
838
msgid "Return ``-1`` with an exception set on error, ``0`` on success."
838
839
msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。"
839
840
840
- #: ../../c-api/module.rst:719
841
+ #: ../../c-api/module.rst:720
841
842
msgid ""
842
843
"Removes the module object created from *def* from the interpreter state. "
843
844
"Return ``-1`` with an exception set on error, ``0`` on success."
0 commit comments