Skip to content

Commit 2d8bd4c

Browse files
sync with cpython 506c76f1
1 parent 0a0a4f7 commit 2d8bd4c

File tree

4 files changed

+188
-173
lines changed

4 files changed

+188
-173
lines changed

c-api/module.po

+41-40
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
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 <[email protected]>\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``."
585585
msgstr ""
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
595589
msgid "Example usage::"
596590
msgstr "用法範例: ::"
597591

598-
#: ../../c-api/module.rst:531
592+
#: ../../c-api/module.rst:528
599593
msgid ""
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
625626
msgid ""
626627
"The example can also be written without checking explicitly if *obj* is "
627628
"``NULL``::"
628629
msgstr ""
629630

630-
#: ../../c-api/module.rst:546
631+
#: ../../c-api/module.rst:547
631632
msgid ""
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
651652
msgid ""
652653
"Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this "
653654
"case, since *obj* can be ``NULL``."
654655
msgstr ""
655656

656-
#: ../../c-api/module.rst:558
657+
#: ../../c-api/module.rst:559
657658
msgid ""
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."
664665
msgstr ""
665666

666-
#: ../../c-api/module.rst:571
667+
#: ../../c-api/module.rst:572
667668
msgid ""
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."
672673
msgstr ""
673674

674-
#: ../../c-api/module.rst:578
675+
#: ../../c-api/module.rst:579
675676
msgid ""
676677
"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n"
677678
" goto error;\n"
678679
"}"
679680
msgstr ""
680681

681-
#: ../../c-api/module.rst:587
682+
#: ../../c-api/module.rst:588
682683
msgid ""
683684
"Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to "
684685
"*value* on success (if it returns ``0``)."
685686
msgstr ""
686687

687-
#: ../../c-api/module.rst:590
688+
#: ../../c-api/module.rst:591
688689
msgid ""
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."
692693
msgstr ""
693694

694-
#: ../../c-api/module.rst:597
695+
#: ../../c-api/module.rst:598
695696
msgid ""
696697
"Unlike other functions that steal references, ``PyModule_AddObject()`` only "
697698
"releases the reference to *value* **on success**."
698699
msgstr ""
699700

700-
#: ../../c-api/module.rst:600
701+
#: ../../c-api/module.rst:601
701702
msgid ""
702703
"This means that its return value must be checked, and calling code must :c:"
703704
"func:`Py_XDECREF` *value* manually on error."
704705
msgstr ""
705706

706-
#: ../../c-api/module.rst:605
707+
#: ../../c-api/module.rst:606
707708
msgid ""
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."
718719
msgstr ""
719720

720-
#: ../../c-api/module.rst:618
721+
#: ../../c-api/module.rst:619
721722
msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`."
722723
msgstr ""
723724

724-
#: ../../c-api/module.rst:623
725+
#: ../../c-api/module.rst:624
725726
msgid ""
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."
729730
msgstr ""
730731

731-
#: ../../c-api/module.rst:627
732+
#: ../../c-api/module.rst:628
732733
msgid ""
733734
"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:"
734735
"func:`PyModule_AddObjectRef`; see their documentation for details."
735736
msgstr ""
736737

737-
#: ../../c-api/module.rst:633
738+
#: ../../c-api/module.rst:634
738739
msgid ""
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."
743744
msgstr ""
744745

745-
#: ../../c-api/module.rst:638
746+
#: ../../c-api/module.rst:639
746747
msgid ""
747748
"This is a convenience function that calls :c:func:"
748749
"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their "
749750
"documentation for details."
750751
msgstr ""
751752

752-
#: ../../c-api/module.rst:645
753+
#: ../../c-api/module.rst:646
753754
msgid ""
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."
758759
msgstr ""
759760

760-
#: ../../c-api/module.rst:653
761+
#: ../../c-api/module.rst:654
761762
msgid "Add a string constant to *module*."
762763
msgstr ""
763764

764-
#: ../../c-api/module.rst:657
765+
#: ../../c-api/module.rst:658
765766
msgid ""
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."
770771
msgstr ""
771772

772-
#: ../../c-api/module.rst:667
773+
#: ../../c-api/module.rst:668
773774
msgid ""
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."
781782
msgstr ""
782783

783-
#: ../../c-api/module.rst:680
784+
#: ../../c-api/module.rst:681
784785
msgid "Module lookup"
785786
msgstr "模組查找"
786787

787-
#: ../../c-api/module.rst:682
788+
#: ../../c-api/module.rst:683
788789
msgid ""
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."
792793
msgstr ""
793794

794-
#: ../../c-api/module.rst:686
795+
#: ../../c-api/module.rst:687
795796
msgid ""
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."
799800
msgstr ""
800801

801-
#: ../../c-api/module.rst:691
802+
#: ../../c-api/module.rst:692
802803
msgid ""
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``."
808809
msgstr ""
809810

810-
#: ../../c-api/module.rst:698
811+
#: ../../c-api/module.rst:699
811812
msgid ""
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`."
815816
msgstr ""
816817

817-
#: ../../c-api/module.rst:701
818+
#: ../../c-api/module.rst:702
818819
msgid "Only effective on modules created using single-phase initialization."
819820
msgstr ""
820821

821-
#: ../../c-api/module.rst:703
822+
#: ../../c-api/module.rst:704
822823
msgid ""
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)."
830831
msgstr ""
831832

832-
#: ../../c-api/module.rst:711 ../../c-api/module.rst:722
833+
#: ../../c-api/module.rst:712 ../../c-api/module.rst:723
833834
msgid "The caller must hold the GIL."
834835
msgstr ""
835836

836-
#: ../../c-api/module.rst:713
837+
#: ../../c-api/module.rst:714
837838
msgid "Return ``-1`` with an exception set on error, ``0`` on success."
838839
msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。"
839840

840-
#: ../../c-api/module.rst:719
841+
#: ../../c-api/module.rst:720
841842
msgid ""
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

Comments
 (0)