From 04d41cfb32849b19ce4a5c8268d493d237ab9b2c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 7 Nov 2025 13:41:29 +0000 Subject: [PATCH 1/3] sync with cpython 7c3539bd --- c-api/module.po | 265 ++++++++++++++++++++++++++---------------------- 1 file changed, 145 insertions(+), 120 deletions(-) diff --git a/c-api/module.po b/c-api/module.po index ff5900e620..2c15f9d411 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-05 00:16+0000\n" +"POT-Creation-Date: 2025-11-07 13:39+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,7 +25,7 @@ msgstr "模組物件" #: ../../c-api/module.rst:15 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python module type. " -"This is exposed to Python programs as ``types.ModuleType``." +"This is exposed to Python programs as :py:class:`types.ModuleType`." msgstr "" #: ../../c-api/module.rst:21 @@ -49,8 +49,8 @@ msgid "" "setting a :attr:`~module.__file__` attribute." msgstr "" -#: ../../c-api/module.rst:46 ../../c-api/module.rst:420 -#: ../../c-api/module.rst:447 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:430 +#: ../../c-api/module.rst:457 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -85,41 +85,54 @@ msgid "" "__dict__`." msgstr "" -#: ../../c-api/module.rst:81 +#: ../../c-api/module.rst:74 +msgid "" +"The returned reference is borrowed from the module; it is valid until the " +"module is destroyed." +msgstr "" + +#: ../../c-api/module.rst:84 msgid "" "Return *module*'s :attr:`~module.__name__` value. If the module does not " "provide one, or if it is not a string, :exc:`SystemError` is raised and " "``NULL`` is returned." msgstr "" -#: ../../c-api/module.rst:90 +#: ../../c-api/module.rst:93 msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" "類似於 :c:func:`PyModule_GetNameObject`,但回傳以 ``'utf-8'`` 編碼的名稱。" -#: ../../c-api/module.rst:95 +#: ../../c-api/module.rst:96 +msgid "" +"The returned buffer is only valid until the module is renamed or destroyed. " +"Note that Python code may rename a module by setting its :py:attr:`~module." +"__name__` attribute." +msgstr "" + +#: ../../c-api/module.rst:102 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " "memory allocated at module creation time, or ``NULL``. See :c:member:" "`PyModuleDef.m_size`." msgstr "" -#: ../../c-api/module.rst:102 +#: ../../c-api/module.rst:109 msgid "" "Return a pointer to the :c:type:`PyModuleDef` struct from which the module " "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: ../../c-api/module.rst:105 +#: ../../c-api/module.rst:112 msgid "" "On error, return ``NULL`` with an exception set. Use :c:func:" "`PyErr_Occurred` to tell this case apart from a missing :c:type:`!" "PyModuleDef`." msgstr "" -#: ../../c-api/module.rst:116 +#: ../../c-api/module.rst:123 msgid "" "Return the name of the file from which *module* was loaded using *module*'s :" "attr:`~module.__file__` attribute. If this is not defined, or if it is not " @@ -127,7 +140,7 @@ msgid "" "reference to a Unicode object." msgstr "" -#: ../../c-api/module.rst:126 +#: ../../c-api/module.rst:133 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." @@ -135,37 +148,43 @@ msgstr "" "類似於 :c:func:`PyModule_GetFilenameObject`,但回傳以 'utf-8' 編碼的檔案名" "稱。" -#: ../../c-api/module.rst:129 +#: ../../c-api/module.rst:136 +msgid "" +"The returned buffer is only valid until the module's :py:attr:`~module." +"__file__` attribute is reassigned or the module is destroyed." +msgstr "" + +#: ../../c-api/module.rst:139 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: ../../c-api/module.rst:137 +#: ../../c-api/module.rst:147 msgid "Module definitions" msgstr "模組定義" -#: ../../c-api/module.rst:139 +#: ../../c-api/module.rst:149 msgid "" "The functions in the previous section work on any module object, including " "modules imported from Python code." msgstr "" -#: ../../c-api/module.rst:142 +#: ../../c-api/module.rst:152 msgid "" "Modules defined using the C API typically use a *module definition*, :c:type:" "`PyModuleDef` -- a statically allocated, constant “description\" of how a " "module should be created." msgstr "" -#: ../../c-api/module.rst:146 +#: ../../c-api/module.rst:156 msgid "" "The definition is usually used to define an extension's “main” module object " "(see :ref:`extension-modules` for details). It is also used to :ref:`create " "extension modules dynamically `." msgstr "" -#: ../../c-api/module.rst:151 +#: ../../c-api/module.rst:161 msgid "" "Unlike :c:func:`PyModule_New`, the definition allows management of *module " "state* -- a piece of memory that is allocated and cleared together with the " @@ -173,7 +192,7 @@ msgid "" "replace or delete data stored in module state." msgstr "" -#: ../../c-api/module.rst:159 +#: ../../c-api/module.rst:169 msgid "" "The module definition struct, which holds all information needed to create a " "module object. This structure must be statically allocated (or be otherwise " @@ -181,42 +200,42 @@ msgid "" "there is only one variable of this type for each extension module." msgstr "" -#: ../../c-api/module.rst:167 +#: ../../c-api/module.rst:177 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:171 +#: ../../c-api/module.rst:181 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:175 +#: ../../c-api/module.rst:185 msgid "" "Docstring for the module; usually a docstring variable created with :c:macro:" "`PyDoc_STRVAR` is used." msgstr "" -#: ../../c-api/module.rst:180 +#: ../../c-api/module.rst:190 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:184 +#: ../../c-api/module.rst:194 msgid "" "This memory area is allocated based on *m_size* on module creation, and " "freed when the module object is deallocated, after the :c:member:" "`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: ../../c-api/module.rst:188 +#: ../../c-api/module.rst:198 msgid "" "Setting it to a non-negative value means that the module can be re-" "initialized and specifies the additional amount of memory it requires for " "its state." msgstr "" -#: ../../c-api/module.rst:192 +#: ../../c-api/module.rst:202 msgid "" "Setting ``m_size`` to ``-1`` means that the module does not support sub-" "interpreters, because it has global state. Negative ``m_size`` is only " @@ -225,37 +244,37 @@ msgid "" "dynamic>`." msgstr "" -#: ../../c-api/module.rst:198 +#: ../../c-api/module.rst:208 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:202 +#: ../../c-api/module.rst:212 msgid "" "A pointer to a table of module-level functions, described by :c:type:" "`PyMethodDef` values. Can be ``NULL`` if no functions are present." msgstr "" -#: ../../c-api/module.rst:207 +#: ../../c-api/module.rst:217 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " "``{0, NULL}`` entry. When using legacy single-phase initialization, " "*m_slots* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:213 +#: ../../c-api/module.rst:223 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "在 3.5 版本之前,這個成員總是被設為 ``NULL``,並被定義為:" -#: ../../c-api/module.rst:220 +#: ../../c-api/module.rst:230 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:223 ../../c-api/module.rst:238 -#: ../../c-api/module.rst:259 +#: ../../c-api/module.rst:233 ../../c-api/module.rst:248 +#: ../../c-api/module.rst:269 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " @@ -265,18 +284,18 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../c-api/module.rst:230 ../../c-api/module.rst:251 -#: ../../c-api/module.rst:266 +#: ../../c-api/module.rst:240 ../../c-api/module.rst:261 +#: ../../c-api/module.rst:276 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:235 +#: ../../c-api/module.rst:245 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:245 +#: ../../c-api/module.rst:255 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -285,55 +304,55 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:256 +#: ../../c-api/module.rst:266 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:271 +#: ../../c-api/module.rst:281 msgid "Module slots" msgstr "模組槽 (Module slots)" -#: ../../c-api/module.rst:277 +#: ../../c-api/module.rst:287 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:281 +#: ../../c-api/module.rst:291 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:285 +#: ../../c-api/module.rst:295 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:289 +#: ../../c-api/module.rst:299 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:296 +#: ../../c-api/module.rst:306 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:301 +#: ../../c-api/module.rst:311 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:305 +#: ../../c-api/module.rst:315 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:308 +#: ../../c-api/module.rst:318 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -342,7 +361,7 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:314 +#: ../../c-api/module.rst:324 msgid "" "There is no requirement for the returned object to be an instance of :c:type:" "`PyModule_Type`. Any type can be used, as long as it supports setting and " @@ -352,7 +371,7 @@ msgid "" "``Py_mod_create``." msgstr "" -#: ../../c-api/module.rst:323 +#: ../../c-api/module.rst:333 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -360,61 +379,61 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:332 +#: ../../c-api/module.rst:342 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:337 ../../c-api/module.rst:370 +#: ../../c-api/module.rst:347 ../../c-api/module.rst:380 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:343 +#: ../../c-api/module.rst:353 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:347 +#: ../../c-api/module.rst:357 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:353 +#: ../../c-api/module.rst:363 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:357 +#: ../../c-api/module.rst:367 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:360 +#: ../../c-api/module.rst:370 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:363 +#: ../../c-api/module.rst:373 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:376 +#: ../../c-api/module.rst:386 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:381 +#: ../../c-api/module.rst:391 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:383 +#: ../../c-api/module.rst:393 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -422,22 +441,22 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:388 +#: ../../c-api/module.rst:398 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:390 +#: ../../c-api/module.rst:400 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:399 +#: ../../c-api/module.rst:409 msgid "Creating extension modules dynamically" msgstr "" -#: ../../c-api/module.rst:401 +#: ../../c-api/module.rst:411 msgid "" "The following functions may be used to create a module outside of an " "extension's :ref:`initialization function `. They are " @@ -445,7 +464,7 @@ msgid "" "initialization>`." msgstr "" -#: ../../c-api/module.rst:408 +#: ../../c-api/module.rst:418 msgid "" "Create a new module object, given the definition in *def*. This is a macro " "that calls :c:func:`PyModule_Create2` with *module_api_version* set to :c:" @@ -453,33 +472,33 @@ msgid "" "the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:416 +#: ../../c-api/module.rst:426 msgid "" "Create a new module object, given the definition in *def*, assuming the API " "version *module_api_version*. If that version does not match the version of " "the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -#: ../../c-api/module.rst:422 +#: ../../c-api/module.rst:432 msgid "" "This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " "member of *def* must be ``NULL``." msgstr "" -#: ../../c-api/module.rst:428 +#: ../../c-api/module.rst:438 msgid "" "Most uses of this function should be using :c:func:`PyModule_Create` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:433 +#: ../../c-api/module.rst:443 msgid "" "This macro calls :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:" "`PYTHON_ABI_VERSION` if using the :ref:`limited API `." msgstr "" -#: ../../c-api/module.rst:442 +#: ../../c-api/module.rst:452 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -487,42 +506,42 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:449 +#: ../../c-api/module.rst:459 msgid "" "Note that this does not process execution slots (:c:data:`Py_mod_exec`). " "Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " "fully initialize a module." msgstr "" -#: ../../c-api/module.rst:455 +#: ../../c-api/module.rst:465 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:462 +#: ../../c-api/module.rst:472 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:468 +#: ../../c-api/module.rst:478 msgid "The C API version. Defined for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:470 ../../c-api/module.rst:477 +#: ../../c-api/module.rst:480 ../../c-api/module.rst:487 msgid "" "Currently, this constant is not updated in new Python versions, and is not " "useful for versioning. This may change in the future." msgstr "" -#: ../../c-api/module.rst:475 +#: ../../c-api/module.rst:485 msgid "Defined as ``3`` for backwards compatibility." msgstr "" -#: ../../c-api/module.rst:482 +#: ../../c-api/module.rst:492 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:484 +#: ../../c-api/module.rst:494 msgid "" "The following functions are provided to help initialize a module state. They " "are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " @@ -530,23 +549,23 @@ msgid "" "phase-initialization>`, or code that creates modules dynamically." msgstr "" -#: ../../c-api/module.rst:492 +#: ../../c-api/module.rst:502 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:495 +#: ../../c-api/module.rst:505 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:497 ../../c-api/module.rst:548 -#: ../../c-api/module.rst:575 +#: ../../c-api/module.rst:507 ../../c-api/module.rst:558 +#: ../../c-api/module.rst:585 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:499 +#: ../../c-api/module.rst:509 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -572,20 +591,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:511 +#: ../../c-api/module.rst:521 msgid "" "To be convenient, the function accepts ``NULL`` *value* with an exception " "set. In this case, return ``-1`` and just leave the raised exception " "unchanged." msgstr "" -#: ../../c-api/module.rst:515 +#: ../../c-api/module.rst:525 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:518 +#: ../../c-api/module.rst:528 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -605,13 +624,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:527 +#: ../../c-api/module.rst:537 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:530 +#: ../../c-api/module.rst:540 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " @@ -621,7 +640,7 @@ msgid "" "internally to create a key object." msgstr "" -#: ../../c-api/module.rst:543 +#: ../../c-api/module.rst:553 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -629,7 +648,7 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:550 +#: ../../c-api/module.rst:560 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" @@ -639,7 +658,7 @@ msgstr "" " goto error;\n" "}" -#: ../../c-api/module.rst:559 +#: ../../c-api/module.rst:569 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." @@ -647,26 +666,26 @@ msgstr "" "類似於 :c:func:`PyModule_AddObjectRef`,但在成功時(如果回傳 ``0``)會偷走對 " "*value* 的參照。" -#: ../../c-api/module.rst:562 +#: ../../c-api/module.rst:572 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:569 +#: ../../c-api/module.rst:579 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:572 +#: ../../c-api/module.rst:582 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:577 +#: ../../c-api/module.rst:587 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -680,25 +699,25 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:590 +#: ../../c-api/module.rst:600 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" ":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" -#: ../../c-api/module.rst:595 +#: ../../c-api/module.rst:605 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:599 +#: ../../c-api/module.rst:609 msgid "" "This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" "func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:605 +#: ../../c-api/module.rst:615 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -706,14 +725,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:610 +#: ../../c-api/module.rst:620 msgid "" "This is a convenience function that calls :c:func:" "`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " "documentation for details." msgstr "" -#: ../../c-api/module.rst:617 +#: ../../c-api/module.rst:627 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -721,11 +740,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:625 +#: ../../c-api/module.rst:635 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:629 +#: ../../c-api/module.rst:639 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -733,7 +752,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:639 +#: ../../c-api/module.rst:649 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -742,7 +761,7 @@ msgid "" "first parameter, making them similar to instance methods on Python classes)." msgstr "" -#: ../../c-api/module.rst:645 +#: ../../c-api/module.rst:655 msgid "" "This function is called automatically when creating a module from " "``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " @@ -751,7 +770,13 @@ msgid "" "that case they should call this function directly." msgstr "" -#: ../../c-api/module.rst:656 +#: ../../c-api/module.rst:662 +msgid "" +"The *functions* array must be statically allocated (or otherwise guaranteed " +"to outlive the module object)." +msgstr "" + +#: ../../c-api/module.rst:669 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef`` (such as when " @@ -759,7 +784,7 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:665 +#: ../../c-api/module.rst:678 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " @@ -771,11 +796,11 @@ msgid "" "on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:679 +#: ../../c-api/module.rst:692 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:681 +#: ../../c-api/module.rst:694 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -783,14 +808,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:686 +#: ../../c-api/module.rst:699 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:691 +#: ../../c-api/module.rst:704 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -799,18 +824,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:698 +#: ../../c-api/module.rst:711 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:701 +#: ../../c-api/module.rst:714 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:703 +#: ../../c-api/module.rst:716 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -822,21 +847,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:712 +#: ../../c-api/module.rst:725 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:715 ../../c-api/module.rst:726 +#: ../../c-api/module.rst:728 ../../c-api/module.rst:739 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:717 +#: ../../c-api/module.rst:730 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:723 +#: ../../c-api/module.rst:736 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -854,7 +879,7 @@ msgstr "module(模組)" msgid "ModuleType (in module types)" msgstr "MethodType(types 模組中)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:77 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:80 msgid "__name__ (module attribute)" msgstr "__name__(模組屬性)" @@ -862,7 +887,7 @@ msgstr "__name__(模組屬性)" msgid "__doc__ (module attribute)" msgstr "__doc__(模組屬性)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:112 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:119 msgid "__file__ (module attribute)" msgstr "__file__(模組屬性)" @@ -878,6 +903,6 @@ msgstr "__loader__(模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__(模組屬性)" -#: ../../c-api/module.rst:77 ../../c-api/module.rst:112 +#: ../../c-api/module.rst:80 ../../c-api/module.rst:119 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" From 4892d8e51c62d7e44e50233e85d313702a0ea048 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 7 Nov 2025 15:16:39 +0000 Subject: [PATCH 2/3] sync with cpython 9f8ec95b --- c-api/capsule.po | 68 ++++++++++++++++++++++++++---------------------- c-api/float.po | 31 ---------------------- 2 files changed, 37 insertions(+), 62 deletions(-) diff --git a/c-api/capsule.po b/c-api/capsule.po index 8caf48d64a..0a50a92d86 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-25 22:20+0000\n" +"POT-Creation-Date: 2025-11-07 15:15+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,62 +37,68 @@ msgid "" msgstr "" #: ../../c-api/capsule.rst:27 +msgid "" +"The type object corresponding to capsule objects. This is the same object " +"as :class:`types.CapsuleType` in the Python layer." +msgstr "" + +#: ../../c-api/capsule.rst:33 msgid "The type of a destructor callback for a capsule. Defined as::" msgstr "" -#: ../../c-api/capsule.rst:29 +#: ../../c-api/capsule.rst:35 msgid "typedef void (*PyCapsule_Destructor)(PyObject *);" msgstr "typedef void (*PyCapsule_Destructor)(PyObject *);" -#: ../../c-api/capsule.rst:31 +#: ../../c-api/capsule.rst:37 msgid "" "See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor " "callbacks." msgstr "" -#: ../../c-api/capsule.rst:37 +#: ../../c-api/capsule.rst:43 msgid "" "Return true if its argument is a :c:type:`PyCapsule`. This function always " "succeeds." msgstr "" -#: ../../c-api/capsule.rst:43 +#: ../../c-api/capsule.rst:49 msgid "" "Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer* " "argument may not be ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:46 +#: ../../c-api/capsule.rst:52 msgid "On failure, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:48 +#: ../../c-api/capsule.rst:54 msgid "" "The *name* string may either be ``NULL`` or a pointer to a valid C string. " "If non-``NULL``, this string must outlive the capsule. (Though it is " "permitted to free it inside the *destructor*.)" msgstr "" -#: ../../c-api/capsule.rst:52 +#: ../../c-api/capsule.rst:58 msgid "" "If the *destructor* argument is not ``NULL``, it will be called with the " "capsule as its argument when it is destroyed." msgstr "" -#: ../../c-api/capsule.rst:55 +#: ../../c-api/capsule.rst:61 msgid "" "If this capsule will be stored as an attribute of a module, the *name* " "should be specified as ``modulename.attributename``. This will enable other " "modules to import the capsule using :c:func:`PyCapsule_Import`." msgstr "" -#: ../../c-api/capsule.rst:62 +#: ../../c-api/capsule.rst:68 msgid "" "Retrieve the *pointer* stored in the capsule. On failure, set an exception " "and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:65 +#: ../../c-api/capsule.rst:71 msgid "" "The *name* parameter must compare exactly to the name stored in the capsule. " "If the name stored in the capsule is ``NULL``, the *name* passed in must " @@ -100,46 +106,46 @@ msgid "" "capsule names." msgstr "" -#: ../../c-api/capsule.rst:73 +#: ../../c-api/capsule.rst:79 msgid "" "Return the current destructor stored in the capsule. On failure, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:76 +#: ../../c-api/capsule.rst:82 msgid "" "It is legal for a capsule to have a ``NULL`` destructor. This makes a " "``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :" "c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/capsule.rst:83 +#: ../../c-api/capsule.rst:89 msgid "" "Return the current context stored in the capsule. On failure, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:86 +#: ../../c-api/capsule.rst:92 msgid "" "It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL`` " "return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" "`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/capsule.rst:93 +#: ../../c-api/capsule.rst:99 msgid "" "Return the current name stored in the capsule. On failure, set an exception " "and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:96 +#: ../../c-api/capsule.rst:102 msgid "" "It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` " "return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" "`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/capsule.rst:103 +#: ../../c-api/capsule.rst:109 msgid "" "Import a pointer to a C object from a capsule attribute in a module. The " "*name* parameter should specify the full name to the attribute, as in " @@ -147,19 +153,19 @@ msgid "" "string exactly." msgstr "" -#: ../../c-api/capsule.rst:108 +#: ../../c-api/capsule.rst:114 msgid "" "This function splits *name* on the ``.`` character, and imports the first " "element. It then processes further elements using attribute lookups." msgstr "" -#: ../../c-api/capsule.rst:111 +#: ../../c-api/capsule.rst:117 msgid "" "Return the capsule's internal *pointer* on success. On failure, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/capsule.rst:116 +#: ../../c-api/capsule.rst:122 msgid "" "If *name* points to an attribute of some submodule or subpackage, this " "submodule or subpackage must be previously imported using other means (for " @@ -167,11 +173,11 @@ msgid "" "to succeed." msgstr "" -#: ../../c-api/capsule.rst:121 +#: ../../c-api/capsule.rst:127 msgid "*no_block* has no effect anymore." msgstr "" -#: ../../c-api/capsule.rst:127 +#: ../../c-api/capsule.rst:133 msgid "" "Determines whether or not *capsule* is a valid capsule. A valid capsule is " "non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` " @@ -180,41 +186,41 @@ msgid "" "compared.)" msgstr "" -#: ../../c-api/capsule.rst:133 +#: ../../c-api/capsule.rst:139 msgid "" "In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls " "to any of the accessors (any function starting with ``PyCapsule_Get``) are " "guaranteed to succeed." msgstr "" -#: ../../c-api/capsule.rst:137 +#: ../../c-api/capsule.rst:143 msgid "" "Return a nonzero value if the object is valid and matches the name passed " "in. Return ``0`` otherwise. This function will not fail." msgstr "" -#: ../../c-api/capsule.rst:143 +#: ../../c-api/capsule.rst:149 msgid "Set the context pointer inside *capsule* to *context*." msgstr "" -#: ../../c-api/capsule.rst:145 ../../c-api/capsule.rst:152 -#: ../../c-api/capsule.rst:161 ../../c-api/capsule.rst:169 +#: ../../c-api/capsule.rst:151 ../../c-api/capsule.rst:158 +#: ../../c-api/capsule.rst:167 ../../c-api/capsule.rst:175 msgid "" "Return ``0`` on success. Return nonzero and set an exception on failure." msgstr "" -#: ../../c-api/capsule.rst:150 +#: ../../c-api/capsule.rst:156 msgid "Set the destructor inside *capsule* to *destructor*." msgstr "" -#: ../../c-api/capsule.rst:157 +#: ../../c-api/capsule.rst:163 msgid "" "Set the name inside *capsule* to *name*. If non-``NULL``, the name must " "outlive the capsule. If the previous *name* stored in the capsule was not " "``NULL``, no attempt is made to free it." msgstr "" -#: ../../c-api/capsule.rst:166 +#: ../../c-api/capsule.rst:172 msgid "" "Set the void pointer inside *capsule* to *pointer*. The pointer may not be " "``NULL``." diff --git a/c-api/float.po b/c-api/float.po index e4fe8707e6..20df90d6ec 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -148,37 +148,6 @@ msgstr "" "打包例程從 C :c:expr:`double` 產生位元組字串,而解包例程則從這樣的位元組字串產生 " "C :c:expr:`double`。後綴(2、4 或 8)標示了位元組字串中的位元組數。" -#: ../../c-api/float.rst:107 -msgid "" -"Return :data:`math.inf` or :data:`-math.inf ` from a function, " -"depending on the sign of *sign*." -msgstr "" -"根據 *sign* 的正負號,從函式回傳 :data:`math.inf` 或 :data:`-math.inf `。" - -#: ../../c-api/float.rst:93 -msgid "On most platforms, this is equivalent to the following::" -msgstr "在大多數平台上,這相當於以下內容: ::" - -#: ../../c-api/float.rst:95 -msgid "return PyFloat_FromDouble(copysign(INFINITY, sign));" -msgstr "return PyFloat_FromDouble(copysign(INFINITY, sign));" - -#: ../../c-api/float.rst:99 -msgid "Pack and Unpack functions" -msgstr "打包和解包函式" - -#: ../../c-api/float.rst:101 -msgid "" -"The pack and unpack functions provide an efficient platform-independent way " -"to store floating-point values as byte strings. The Pack routines produce a " -"bytes string from a C :c:expr:`double`, and the Unpack routines produce a C :" -"c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies " -"the number of bytes in the bytes string." -msgstr "" -"打包和解包函式提供了一種有效的跨平台方式,來將浮點數值儲存為位元組字串。" -"打包例程從 C :c:expr:`double` 產生位元組字串,而解包例程則從這樣的位元組字串產生 " -"C :c:expr:`double`。後綴(2、4 或 8)標示了位元組字串中的位元組數。" - #: ../../c-api/float.rst:107 msgid "" "On platforms that appear to use IEEE 754 formats these functions work by " From bbb98e91ce2ad0d9c79b9e643811ffb7754b9b32 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 7 Nov 2025 15:34:17 +0000 Subject: [PATCH 3/3] sync with cpython 9f8ec95b --- c-api/float.po | 96 +++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 45 deletions(-) diff --git a/c-api/float.po b/c-api/float.po index 20df90d6ec..081f6b36a9 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-06 00:14+0000\n" +"POT-Creation-Date: 2025-11-07 15:32+0000\n" "PO-Revision-Date: 2025-11-07 05:06+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,35 +34,38 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python floating-point " "type. This is the same object as :class:`float` in the Python layer." msgstr "" -"這個 :c:type:`PyTypeObject` 的實例代表 Python 浮點數型別。這與 Python 層中的 :class:`float` " -"物件相同。" +"這個 :c:type:`PyTypeObject` 的實例代表 Python 浮點數型別。這與 Python 層中" +"的 :class:`float` 物件相同。" #: ../../c-api/float.rst:24 msgid "" "Return true if its argument is a :c:type:`PyFloatObject` or a subtype of :c:" "type:`PyFloatObject`. This function always succeeds." msgstr "" -"如果其引數是 :c:type:`PyFloatObject` 或 :c:type:`PyFloatObject` 的子型別,則回傳 " -"true。這個函式不會失敗。" +"如果其引數是 :c:type:`PyFloatObject` 或 :c:type:`PyFloatObject` 的子型別,則" +"回傳 true。這個函式不會失敗。" #: ../../c-api/float.rst:30 msgid "" "Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype " "of :c:type:`PyFloatObject`. This function always succeeds." msgstr "" -"如果其引數是 :c:type:`PyFloatObject`,但不是 :c:type:`PyFloatObject` 的子型別," -"則回傳 true。這個函式不會失敗。" +"如果其引數是 :c:type:`PyFloatObject`,但不是 :c:type:`PyFloatObject` 的子型" +"別,則回傳 true。這個函式不會失敗。" #: ../../c-api/float.rst:36 msgid "" "Create a :c:type:`PyFloatObject` object based on the string value in *str*, " "or ``NULL`` on failure." -msgstr "建立一個基於字串值 *str* 的 :c:type:`PyFloatObject` 物件,失敗時回傳 ``NULL``。" +msgstr "" +"建立一個基於字串值 *str* 的 :c:type:`PyFloatObject` 物件,失敗時回傳 " +"``NULL``。" #: ../../c-api/float.rst:42 msgid "" "Create a :c:type:`PyFloatObject` object from *v*, or ``NULL`` on failure." -msgstr "建立一個來自 *v* 的 :c:type:`PyFloatObject` 物件,失敗時回傳 ``NULL``。" +msgstr "" +"建立一個來自 *v* 的 :c:type:`PyFloatObject` 物件,失敗時回傳 ``NULL``。" #: ../../c-api/float.rst:47 msgid "" @@ -73,11 +76,11 @@ msgid "" "meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " "should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" -"回傳 *pyfloat* 內容的 C :c:expr:`double` 表示形式。" -"如果 *pyfloat* 不是 Python 浮點數物件,但具有 :meth:`~object.__float__` 方法," -"則會先呼叫此方法將 *pyfloat* 轉換為浮點數。" -"如果未定義 :meth:`!__float__`,則會用後備方法 :meth:`~object.__index__`。" -"此方法在失敗時回傳 ``-1.0``,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" +"回傳 *pyfloat* 內容的 C :c:expr:`double` 表示形式。如果 *pyfloat* 不是 " +"Python 浮點數物件,但具有 :meth:`~object.__float__` 方法,則會先呼叫此方法將 " +"*pyfloat* 轉換為浮點數。如果未定義 :meth:`!__float__`,則會用後備方法 :meth:" +"`~object.__index__`。此方法在失敗時回傳 ``-1.0``,因此應該呼叫 :c:func:" +"`PyErr_Occurred` 來檢查錯誤。" #: ../../c-api/float.rst:54 msgid "Use :meth:`~object.__index__` if available." @@ -95,8 +98,8 @@ msgid "" "minimum and maximum values of a float. It's a thin wrapper around the header " "file :file:`float.h`." msgstr "" -"回傳一個 structseq 實例,其中包含有關浮點數的精度、最小值和最大值的資訊。" -"它是對標頭檔 :file:`float.h` 的簡單封裝。" +"回傳一個 structseq 實例,其中包含有關浮點數的精度、最小值和最大值的資訊。它是" +"對標頭檔 :file:`float.h` 的簡單封裝。" #: ../../c-api/float.rst:73 msgid "" @@ -122,7 +125,9 @@ msgstr "在大多數平台上,這相當於 ``return PyFloat_FromDouble(NAN)`` msgid "" "Return :data:`math.inf` or :data:`-math.inf ` from a function, " "depending on the sign of *sign*." -msgstr "根據 *sign* 的正負號,從函式回傳 :data:`math.inf` 或 :data:`-math.inf `。" +msgstr "" +"根據 *sign* 的正負號,從函式回傳 :data:`math.inf` 或 :data:`-math.inf `。" #: ../../c-api/float.rst:93 msgid "On most platforms, this is equivalent to the following::" @@ -144,8 +149,8 @@ msgid "" "c:expr:`double` from such a bytes string. The suffix (2, 4 or 8) specifies " "the number of bytes in the bytes string." msgstr "" -"打包和解包函式提供了一種有效的跨平台方式,來將浮點數值儲存為位元組字串。" -"打包例程從 C :c:expr:`double` 產生位元組字串,而解包例程則從這樣的位元組字串產生 " +"打包和解包函式提供了一種有效的跨平台方式,來將浮點數值儲存為位元組字串。打包" +"例程從 C :c:expr:`double` 產生位元組字串,而解包例程則從這樣的位元組字串產生 " "C :c:expr:`double`。後綴(2、4 或 8)標示了位元組字串中的位元組數。" #: ../../c-api/float.rst:107 @@ -159,20 +164,19 @@ msgid "" "attempting to unpack a bytes string containing an IEEE INF or NaN will raise " "an exception." msgstr "" -"在看似使用 IEEE 754 格式的平台上,這些函式是透過複製位元來運作的。" -"在其他平台上,2 位元組格式與 IEEE 754 binary16 半精度格式相同," -"4 位元組格式(32 位元)與 IEEE 754 binary32 單精度格式相同," -"8 位元組格式與 IEEE 754 binary64 雙精度格式相同。" -"儘管如此,INF 和 NaN(如果這些東西在平台上存在)的打包並未正確處理," -"並且嘗試解包包含 IEEE INF 或 NaN 的位元組字串將引發例外。" +"在看似使用 IEEE 754 格式的平台上,這些函式是透過複製位元來運作的。在其他平台" +"上,2 位元組格式與 IEEE 754 binary16 半精度格式相同,4 位元組格式(32 位元)" +"與 IEEE 754 binary32 單精度格式相同,8 位元組格式與 IEEE 754 binary64 雙精度" +"格式相同。儘管如此,INF 和 NaN(如果這些東西在平台上存在)的打包並未正確處" +"理,並且嘗試解包包含 IEEE INF 或 NaN 的位元組字串將引發例外。" #: ../../c-api/float.rst:116 msgid "" -"Note that NaNs type may not be preserved on IEEE platforms (silent NaN " -"become quiet), for example on x86 systems in 32-bit mode." +"Note that NaNs type may not be preserved on IEEE platforms (signaling NaN " +"become quiet NaN), for example on x86 systems in 32-bit mode." msgstr "" -"請注意,在 IEEE 平台上可能無法保留 NaN 型別(「靜默型 NaN (silent NaN)」會變成" -"「安靜型 NaN (quiet NaN)」),例如在 32 位元模式的 x86 系統上。" +"請注意,在 IEEE 平台上可能無法保留 NaN 型別(「靜默型 NaN (silent NaN)」會變" +"成「安靜型 NaN (quiet NaN)」),例如在 32 位元模式的 x86 系統上。" #: ../../c-api/float.rst:119 msgid "" @@ -181,9 +185,9 @@ msgid "" "less precision, or smaller dynamic range, not all values can be unpacked. " "What happens in such cases is partly accidental (alas)." msgstr "" -"在非 IEEE 平台上,如果精度更高或動態範圍比 IEEE 754 支援的更大," -"則無法打包所有值;在非 IEEE 平台上,如果精度較低或動態範圍較小," -"則無法解包所有值。在這種案例下發生的情況在某種程度上是偶然的(唉)。" +"在非 IEEE 平台上,如果精度更高或動態範圍比 IEEE 754 支援的更大,則無法打包所" +"有值;在非 IEEE 平台上,如果精度較低或動態範圍較小,則無法解包所有值。在這種" +"案例下發生的情況在某種程度上是偶然的(唉)。" #: ../../c-api/float.rst:127 msgid "Pack functions" @@ -199,18 +203,18 @@ msgid "" "to ``1`` on big endian processor, or ``0`` on little endian processor." msgstr "" "打包例程會從 *p* 開始寫入 2、4 或 8 位元組。*le* 是一個 :c:expr:`int` 引數," -"如果你想要位元組字串為小端序格式(指數在最後,位於 ``p+1``、``p+3``、" -"``p+6`` 或 ``p+7``),則用非零值;如果你想要大端序格式(指數在最前,位於 *p*)," -"則用零。可以使用 :c:macro:`PY_BIG_ENDIAN` 常數來使用原生端序:" -"在大端序處理器上它等於 ``1``,在小端序處理器上它等於 ``0``。" +"如果你想要位元組字串為小端序格式(指數在最後,位於 ``p+1``、``p+3``、``p+6`` " +"或 ``p+7``),則用非零值;如果你想要大端序格式(指數在最前,位於 *p*),則用" +"零。可以使用 :c:macro:`PY_BIG_ENDIAN` 常數來使用原生端序:在大端序處理器上它" +"等於 ``1``,在小端序處理器上它等於 ``0``。" #: ../../c-api/float.rst:136 msgid "" "Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " "most likely :exc:`OverflowError`)." msgstr "" -"回傳值:如果一切正常則為 ``0``,如果發生錯誤則為 ``-1``\\ (並且會設定一個例外," -"最有可能是 :exc:`OverflowError`)。" +"回傳值:如果一切正常則為 ``0``,如果發生錯誤則為 ``-1``\\ (並且會設定一個例" +"外,最有可能是 :exc:`OverflowError`)。" #: ../../c-api/float.rst:139 msgid "There are two problems on non-IEEE platforms:" @@ -250,10 +254,10 @@ msgid "" "processor, or ``0`` on little endian processor." msgstr "" "解包例程會從 *p* 開始讀取 2、4 或 8 位元組。*le* 是一個 :c:expr:`int` 引數," -"如果位元組字串為小端序格式(指數在最後,位於 ``p+1``、``p+3``、" -"``p+6`` 或 ``p+7``),則用非零值;如果為大端序格式(指數在最前,位於 *p*),則用零。" -"可以使用 :c:macro:`PY_BIG_ENDIAN` 常數來使用原生端序:在大端序處理器上它等於 ``1``," -"在小端序處理器上它等於 ``0``。" +"如果位元組字串為小端序格式(指數在最後,位於 ``p+1``、``p+3``、``p+6`` 或 " +"``p+7``),則用非零值;如果為大端序格式(指數在最前,位於 *p*),則用零。可以" +"使用 :c:macro:`PY_BIG_ENDIAN` 常數來使用原生端序:在大端序處理器上它等於 " +"``1``,在小端序處理器上它等於 ``0``。" #: ../../c-api/float.rst:167 msgid "" @@ -261,14 +265,16 @@ msgid "" "`PyErr_Occurred` is true (and an exception is set, most likely :exc:" "`OverflowError`)." msgstr "" -"回傳值:解包後的 double。發生錯誤時,這是 ``-1.0`` 且 :c:func:`PyErr_Occurred` " -"為 true(並且會設置一個例外,最有可能是 :exc:`OverflowError`)。" +"回傳值:解包後的 double。發生錯誤時,這是 ``-1.0`` 且 :c:func:" +"`PyErr_Occurred` 為 true(並且會設置一個例外,最有可能是 :exc:" +"`OverflowError`)。" #: ../../c-api/float.rst:171 msgid "" "Note that on a non-IEEE platform this will refuse to unpack a bytes string " "that represents a NaN or infinity." -msgstr "請注意,在非 IEEE 平台上,這將拒絕解包會表示為 NaN 或無窮大的位元組字串。" +msgstr "" +"請注意,在非 IEEE 平台上,這將拒絕解包會表示為 NaN 或無窮大的位元組字串。" #: ../../c-api/float.rst:176 msgid "Unpack the IEEE 754 binary16 half-precision format as a C double."