77msgstr ""
88"Project-Id-Version : Python 3.13\n "
99"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 "
1111"PO-Revision-Date : 2018-05-23 14:32+0000\n "
1212"Last-Translator : Adrian Liaw <adrianliaw2000@gmail.com>\n "
1313"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
@@ -584,18 +584,12 @@ msgid ""
584584"On success, return ``0``. On error, raise an exception and return ``-1``."
585585msgstr ""
586586
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
595589msgid "Example usage::"
596590msgstr "用法範例: ::"
597591
598- #: ../../c-api/module.rst:531
592+ #: ../../c-api/module.rst:528
599593msgid ""
600594"static int\n"
601595"add_spam(PyObject *module, int value)\n"
@@ -621,13 +615,20 @@ msgstr ""
621615" return res;\n"
622616" }"
623617
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
625626msgid ""
626627"The example can also be written without checking explicitly if *obj* is "
627628"``NULL``::"
628629msgstr ""
629630
630- #: ../../c-api/module.rst:546
631+ #: ../../c-api/module.rst:547
631632msgid ""
632633"static int\n"
633634"add_spam(PyObject *module, int value)\n"
@@ -647,13 +648,13 @@ msgstr ""
647648" return res;\n"
648649" }"
649650
650- #: ../../c-api/module.rst:555
651+ #: ../../c-api/module.rst:556
651652msgid ""
652653"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this "
653654"case, since *obj* can be ``NULL``."
654655msgstr ""
655656
656- #: ../../c-api/module.rst:558
657+ #: ../../c-api/module.rst:559
657658msgid ""
658659"The number of different *name* strings passed to this function should be "
659660"kept small, usually by only using statically allocated strings as *name*. "
@@ -663,47 +664,47 @@ msgid ""
663664"internally to create a key object."
664665msgstr ""
665666
666- #: ../../c-api/module.rst:571
667+ #: ../../c-api/module.rst:572
667668msgid ""
668669"Similar to :c:func:`PyModule_AddObjectRef`, but \" steals\" a reference to "
669670"*value*. It can be called with a result of function that returns a new "
670671"reference without bothering to check its result or even saving it to a "
671672"variable."
672673msgstr ""
673674
674- #: ../../c-api/module.rst:578
675+ #: ../../c-api/module.rst:579
675676msgid ""
676677"if (PyModule_Add(module, \" spam\" , PyBytes_FromString(value)) < 0) {\n"
677678" goto error;\n"
678679"}"
679680msgstr ""
680681
681- #: ../../c-api/module.rst:587
682+ #: ../../c-api/module.rst:588
682683msgid ""
683684"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
684685"*value* on success (if it returns ``0``)."
685686msgstr ""
686687
687- #: ../../c-api/module.rst:590
688+ #: ../../c-api/module.rst:591
688689msgid ""
689690"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions "
690691"are recommended, since it is easy to introduce reference leaks by misusing "
691692"the :c:func:`PyModule_AddObject` function."
692693msgstr ""
693694
694- #: ../../c-api/module.rst:597
695+ #: ../../c-api/module.rst:598
695696msgid ""
696697"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
697698"releases the reference to *value* **on success**."
698699msgstr ""
699700
700- #: ../../c-api/module.rst:600
701+ #: ../../c-api/module.rst:601
701702msgid ""
702703"This means that its return value must be checked, and calling code must :c:"
703704"func:`Py_XDECREF` *value* manually on error."
704705msgstr ""
705706
706- #: ../../c-api/module.rst:605
707+ #: ../../c-api/module.rst:606
707708msgid ""
708709"PyObject *obj = PyBytes_FromString(value);\n"
709710"if (PyModule_AddObject(module, \" spam\" , obj) < 0) {\n"
@@ -717,59 +718,59 @@ msgid ""
717718"// Py_XDECREF(obj) is not needed here."
718719msgstr ""
719720
720- #: ../../c-api/module.rst:618
721+ #: ../../c-api/module.rst:619
721722msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`."
722723msgstr ""
723724
724- #: ../../c-api/module.rst:623
725+ #: ../../c-api/module.rst:624
725726msgid ""
726727"Add an integer constant to *module* as *name*. This convenience function "
727728"can be used from the module's initialization function. Return ``-1`` with an "
728729"exception set on error, ``0`` on success."
729730msgstr ""
730731
731- #: ../../c-api/module.rst:627
732+ #: ../../c-api/module.rst:628
732733msgid ""
733734"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:"
734735"func:`PyModule_AddObjectRef`; see their documentation for details."
735736msgstr ""
736737
737- #: ../../c-api/module.rst:633
738+ #: ../../c-api/module.rst:634
738739msgid ""
739740"Add a string constant to *module* as *name*. This convenience function can "
740741"be used from the module's initialization function. The string *value* must "
741742"be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` "
742743"on success."
743744msgstr ""
744745
745- #: ../../c-api/module.rst:638
746+ #: ../../c-api/module.rst:639
746747msgid ""
747748"This is a convenience function that calls :c:func:"
748749"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their "
749750"documentation for details."
750751msgstr ""
751752
752- #: ../../c-api/module.rst:645
753+ #: ../../c-api/module.rst:646
753754msgid ""
754755"Add an int constant to *module*. The name and the value are taken from "
755756"*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int "
756757"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` "
757758"with an exception set on error, ``0`` on success."
758759msgstr ""
759760
760- #: ../../c-api/module.rst:653
761+ #: ../../c-api/module.rst:654
761762msgid "Add a string constant to *module*."
762763msgstr ""
763764
764- #: ../../c-api/module.rst:657
765+ #: ../../c-api/module.rst:658
765766msgid ""
766767"Add a type object to *module*. The type object is finalized by calling "
767768"internally :c:func:`PyType_Ready`. The name of the type object is taken from "
768769"the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return "
769770"``-1`` with an exception set on error, ``0`` on success."
770771msgstr ""
771772
772- #: ../../c-api/module.rst:667
773+ #: ../../c-api/module.rst:668
773774msgid ""
774775"Indicate that *module* does or does not support running without the global "
775776"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. "
@@ -780,25 +781,25 @@ msgid ""
780781"Return ``-1`` with an exception set on error, ``0`` on success."
781782msgstr ""
782783
783- #: ../../c-api/module.rst:680
784+ #: ../../c-api/module.rst:681
784785msgid "Module lookup"
785786msgstr "模組查找"
786787
787- #: ../../c-api/module.rst:682
788+ #: ../../c-api/module.rst:683
788789msgid ""
789790"Single-phase initialization creates singleton modules that can be looked up "
790791"in the context of the current interpreter. This allows the module object to "
791792"be retrieved later with only a reference to the module definition."
792793msgstr ""
793794
794- #: ../../c-api/module.rst:686
795+ #: ../../c-api/module.rst:687
795796msgid ""
796797"These functions will not work on modules created using multi-phase "
797798"initialization, since multiple such modules can be created from a single "
798799"definition."
799800msgstr ""
800801
801- #: ../../c-api/module.rst:691
802+ #: ../../c-api/module.rst:692
802803msgid ""
803804"Returns the module object that was created from *def* for the current "
804805"interpreter. This method requires that the module object has been attached "
@@ -807,18 +808,18 @@ msgid ""
807808"to the interpreter state yet, it returns ``NULL``."
808809msgstr ""
809810
810- #: ../../c-api/module.rst:698
811+ #: ../../c-api/module.rst:699
811812msgid ""
812813"Attaches the module object passed to the function to the interpreter state. "
813814"This allows the module object to be accessible via :c:func:"
814815"`PyState_FindModule`."
815816msgstr ""
816817
817- #: ../../c-api/module.rst:701
818+ #: ../../c-api/module.rst:702
818819msgid "Only effective on modules created using single-phase initialization."
819820msgstr ""
820821
821- #: ../../c-api/module.rst:703
822+ #: ../../c-api/module.rst:704
822823msgid ""
823824"Python calls ``PyState_AddModule`` automatically after importing a module, "
824825"so it is unnecessary (but harmless) to call it from module initialization "
@@ -829,15 +830,15 @@ msgid ""
829830"state updates)."
830831msgstr ""
831832
832- #: ../../c-api/module.rst:711 ../../c-api/module.rst:722
833+ #: ../../c-api/module.rst:712 ../../c-api/module.rst:723
833834msgid "The caller must hold the GIL."
834835msgstr ""
835836
836- #: ../../c-api/module.rst:713
837+ #: ../../c-api/module.rst:714
837838msgid "Return ``-1`` with an exception set on error, ``0`` on success."
838839msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。"
839840
840- #: ../../c-api/module.rst:719
841+ #: ../../c-api/module.rst:720
841842msgid ""
842843"Removes the module object created from *def* from the interpreter state. "
843844"Return ``-1`` with an exception set on error, ``0`` on success."
0 commit comments