diff --git a/c-api/allocation.po b/c-api/allocation.po index 616ca9afcf..fc4f138b34 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-09 17:02+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,7 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" #: ../../c-api/allocation.rst:6 -msgid "Allocating Objects on the Heap" +msgid "Allocating objects on the heap" msgstr "在 heap 上分配物件" #: ../../c-api/allocation.rst:17 @@ -132,8 +132,8 @@ msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" #: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 -#: ../../c-api/allocation.rst:182 ../../c-api/allocation.rst:184 -#: ../../c-api/allocation.rst:186 +#: ../../c-api/allocation.rst:184 ../../c-api/allocation.rst:186 +#: ../../c-api/allocation.rst:188 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" @@ -214,43 +214,43 @@ msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" #: ../../c-api/allocation.rst:157 -msgid "Deprecated aliases" -msgstr "被棄用的別名" +msgid "Soft-deprecated aliases" +msgstr "軟性棄用的別名" -#: ../../c-api/allocation.rst:159 +#: ../../c-api/allocation.rst:161 msgid "" -"These are :term:`soft deprecated` aliases to existing functions and macros. " -"They exist solely for backwards compatibility." +"These are aliases to existing functions and macros. They exist solely for " +"backwards compatibility." msgstr "" -#: ../../c-api/allocation.rst:167 -msgid "Deprecated alias" -msgstr "已棄用的別名" +#: ../../c-api/allocation.rst:169 +msgid "Soft-deprecated alias" +msgstr "軟性棄用的別名" -#: ../../c-api/allocation.rst:168 +#: ../../c-api/allocation.rst:170 msgid "Function" msgstr "函式" -#: ../../c-api/allocation.rst:170 +#: ../../c-api/allocation.rst:172 msgid ":c:macro:`PyObject_New`" msgstr ":c:macro:`PyObject_New`" -#: ../../c-api/allocation.rst:172 +#: ../../c-api/allocation.rst:174 msgid ":c:macro:`PyObject_NewVar`" msgstr ":c:macro:`PyObject_NewVar`" -#: ../../c-api/allocation.rst:174 +#: ../../c-api/allocation.rst:176 msgid ":c:func:`PyObject_Init`" msgstr ":c:func:`PyObject_Init`" -#: ../../c-api/allocation.rst:176 +#: ../../c-api/allocation.rst:178 msgid ":c:func:`PyObject_InitVar`" msgstr ":c:func:`PyObject_InitVar`" -#: ../../c-api/allocation.rst:178 +#: ../../c-api/allocation.rst:180 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" -#: ../../c-api/allocation.rst:180 +#: ../../c-api/allocation.rst:182 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" diff --git a/c-api/file.po b/c-api/file.po index 63a9922c85..a8c54fa86a 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-23 00:22+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2023-04-24 20:38+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,7 @@ msgstr "" "X-Generator: Poedit 3.2.2\n" #: ../../c-api/file.rst:6 -msgid "File Objects" +msgid "File objects" msgstr "檔案物件 (File Objects)" #: ../../c-api/file.rst:10 @@ -219,19 +219,18 @@ msgstr "" "的例外狀況。" #: ../../c-api/file.rst:140 -msgid "Deprecated API" -msgstr "已棄用的 API" +msgid "Soft-deprecated API" +msgstr "軟性棄用的 API" -#: ../../c-api/file.rst:143 +#: ../../c-api/file.rst:144 msgid "" -"These are :term:`soft deprecated` APIs that were included in Python's C API " -"by mistake. They are documented solely for completeness; use other " -"``PyFile*`` APIs instead." +"These are APIs that were included in Python's C API by mistake. They are " +"documented solely for completeness; use other ``PyFile*`` APIs instead." msgstr "" -"這些是被錯誤地包含在 Python C API 中的\\ :term:`軟性棄用 ` " -"API。它們僅為了完整性而記錄於文件中;請改用其他 ``PyFile*`` API。" +"這些是被錯誤地包含在 Python C API 中的 API。它們僅為了完整性而記錄於文件中;" +"請改用其他 ``PyFile*`` API。" -#: ../../c-api/file.rst:149 +#: ../../c-api/file.rst:150 msgid "" "Use :c:func:`PyFile_FromFd` with defaults (``fd, NULL, \"w\", -1, NULL, " "NULL, NULL, 0``) instead." @@ -239,7 +238,7 @@ msgstr "" "請改用帶有預設值 (``fd, NULL, \"w\", -1, NULL, NULL, NULL, 0``) 的 :c:func:" "`PyFile_FromFd`。" -#: ../../c-api/file.rst:153 +#: ../../c-api/file.rst:154 msgid "" "Type of file-like objects used internally at Python startup when :py:mod:" "`io` is not yet available. Use Python :py:func:`open` or :c:func:" diff --git a/c-api/frame.po b/c-api/frame.po index 1d376aec5c..2f0d059472 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-28 00:16+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../c-api/frame.rst:4 -msgid "Frame Objects" +msgid "Frame objects" msgstr "Frame 物件" #: ../../c-api/frame.rst:8 @@ -173,7 +173,7 @@ msgid "Return the line number that *frame* is currently executing." msgstr "" #: ../../c-api/frame.rst:151 -msgid "Frame Locals Proxies" +msgid "Frame locals proxies" msgstr "" #: ../../c-api/frame.rst:155 @@ -198,7 +198,7 @@ msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." msgstr "" #: ../../c-api/frame.rst:173 -msgid "Legacy Local Variable APIs" +msgid "Legacy local variable APIs" msgstr "" #: ../../c-api/frame.rst:175 @@ -207,12 +207,7 @@ msgid "" "They exist solely for backwards compatibility." msgstr "" -#: ../../c-api/frame.rst:181 ../../c-api/frame.rst:195 -#: ../../c-api/frame.rst:208 -msgid "This function is :term:`soft deprecated` and does nothing." -msgstr "" - -#: ../../c-api/frame.rst:183 +#: ../../c-api/frame.rst:181 msgid "" "Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` " "attribute of *f* to the internal \"fast\" array of local variables, allowing " @@ -221,12 +216,12 @@ msgid "" "dictionary." msgstr "" -#: ../../c-api/frame.rst:189 ../../c-api/frame.rst:202 -#: ../../c-api/frame.rst:214 +#: ../../c-api/frame.rst:187 ../../c-api/frame.rst:198 +#: ../../c-api/frame.rst:208 msgid "This function now does nothing." msgstr "" -#: ../../c-api/frame.rst:197 +#: ../../c-api/frame.rst:193 msgid "" "Prior to Python 3.13, this function would copy the internal \"fast\" array " "of local variables (which is used by the interpreter) to the :attr:`~frame." @@ -234,38 +229,38 @@ msgid "" "visible to frame objects." msgstr "" -#: ../../c-api/frame.rst:210 +#: ../../c-api/frame.rst:204 msgid "" "Prior to Python 3.13, this function was similar to :c:func:" "`PyFrame_FastToLocals`, but would return ``0`` on success, and ``-1`` with " "an exception set on failure." msgstr "" -#: ../../c-api/frame.rst:219 +#: ../../c-api/frame.rst:213 msgid ":pep:`667`" msgstr ":pep:`667`" -#: ../../c-api/frame.rst:223 -msgid "Internal Frames" +#: ../../c-api/frame.rst:217 +msgid "Internal frames" msgstr "" -#: ../../c-api/frame.rst:225 +#: ../../c-api/frame.rst:219 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:229 +#: ../../c-api/frame.rst:223 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:235 +#: ../../c-api/frame.rst:229 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:242 +#: ../../c-api/frame.rst:236 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:249 +#: ../../c-api/frame.rst:243 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 36f31a0565..9e87f06193 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-01-16 00:15+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -189,7 +189,7 @@ msgid "" "`PyLong_FromLongLong`, depending on the size of the system's PID type." msgstr "" -#: ../../c-api/long.rst:181 ../../c-api/long.rst:217 +#: ../../c-api/long.rst:181 ../../c-api/long.rst:215 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " @@ -202,39 +202,34 @@ msgid "" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:188 ../../c-api/long.rst:226 ../../c-api/long.rst:247 -#: ../../c-api/long.rst:267 ../../c-api/long.rst:290 +#: ../../c-api/long.rst:188 ../../c-api/long.rst:224 ../../c-api/long.rst:245 +#: ../../c-api/long.rst:265 ../../c-api/long.rst:288 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:190 ../../c-api/long.rst:228 ../../c-api/long.rst:249 -#: ../../c-api/long.rst:271 ../../c-api/long.rst:355 ../../c-api/long.rst:375 +#: ../../c-api/long.rst:190 ../../c-api/long.rst:226 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:269 ../../c-api/long.rst:353 ../../c-api/long.rst:373 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:193 ../../c-api/long.rst:231 ../../c-api/long.rst:252 -#: ../../c-api/long.rst:274 ../../c-api/long.rst:358 ../../c-api/long.rst:378 +#: ../../c-api/long.rst:193 ../../c-api/long.rst:229 ../../c-api/long.rst:250 +#: ../../c-api/long.rst:272 ../../c-api/long.rst:356 ../../c-api/long.rst:376 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" #: ../../c-api/long.rst:200 msgid "" -"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " -"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " -"another exception." +"Exactly equivalent to the preferred ``PyLong_AsLong``. In particular, it can " +"fail with :exc:`OverflowError` or another exception." msgstr "" -#: ../../c-api/long.rst:204 -msgid "The function is soft deprecated." -msgstr "" - -#: ../../c-api/long.rst:209 +#: ../../c-api/long.rst:207 msgid "" "Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" "`int` instead of a C :c:expr:`long`." msgstr "" -#: ../../c-api/long.rst:221 +#: ../../c-api/long.rst:219 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -242,20 +237,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:240 ../../c-api/long.rst:258 +#: ../../c-api/long.rst:238 ../../c-api/long.rst:256 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:244 +#: ../../c-api/long.rst:242 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:262 +#: ../../c-api/long.rst:260 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -263,170 +258,170 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:284 +#: ../../c-api/long.rst:282 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:287 +#: ../../c-api/long.rst:285 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:299 +#: ../../c-api/long.rst:297 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:302 +#: ../../c-api/long.rst:300 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:305 +#: ../../c-api/long.rst:303 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:315 +#: ../../c-api/long.rst:313 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:318 +#: ../../c-api/long.rst:316 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:321 +#: ../../c-api/long.rst:319 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:330 +#: ../../c-api/long.rst:328 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:333 +#: ../../c-api/long.rst:331 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" "c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:336 +#: ../../c-api/long.rst:334 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:339 +#: ../../c-api/long.rst:337 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:345 +#: ../../c-api/long.rst:343 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:349 +#: ../../c-api/long.rst:347 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:352 +#: ../../c-api/long.rst:350 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:364 +#: ../../c-api/long.rst:362 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:369 +#: ../../c-api/long.rst:367 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:372 +#: ../../c-api/long.rst:370 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:385 +#: ../../c-api/long.rst:383 msgid "" "Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:388 ../../c-api/long.rst:408 +#: ../../c-api/long.rst:386 ../../c-api/long.rst:406 msgid "" "If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:" "`~object.__index__` method (if present) to convert it to a :c:type:" "`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:392 ../../c-api/long.rst:413 +#: ../../c-api/long.rst:390 ../../c-api/long.rst:411 msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." msgstr "" -#: ../../c-api/long.rst:394 ../../c-api/long.rst:415 +#: ../../c-api/long.rst:392 ../../c-api/long.rst:413 msgid "" "Set *\\*value* and return ``0`` on success. Set an exception and return " "``-1`` on error." msgstr "" -#: ../../c-api/long.rst:397 ../../c-api/long.rst:418 +#: ../../c-api/long.rst:395 ../../c-api/long.rst:416 msgid "*value* must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:405 +#: ../../c-api/long.rst:403 msgid "" "Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " "representation of *obj*." msgstr "" -#: ../../c-api/long.rst:412 +#: ../../c-api/long.rst:410 msgid "If *obj* is negative, raise a :exc:`ValueError`." msgstr "" -#: ../../c-api/long.rst:425 +#: ../../c-api/long.rst:423 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:428 +#: ../../c-api/long.rst:426 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:431 +#: ../../c-api/long.rst:429 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:436 +#: ../../c-api/long.rst:434 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " @@ -434,26 +429,26 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:441 +#: ../../c-api/long.rst:439 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:446 +#: ../../c-api/long.rst:444 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" -#: ../../c-api/long.rst:450 +#: ../../c-api/long.rst:448 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" -#: ../../c-api/long.rst:454 +#: ../../c-api/long.rst:452 msgid "" "Otherwise, returns the number of bytes required to store the value. If this " "is equal to or less than *n_bytes*, the entire value was copied. All " @@ -461,7 +456,7 @@ msgid "" "sign bit." msgstr "" -#: ../../c-api/long.rst:459 +#: ../../c-api/long.rst:457 msgid "" "If the returned value is greater than *n_bytes*, the value was truncated: as " "many of the lowest bits of the value as could fit are written, and the " @@ -469,25 +464,25 @@ msgid "" "downcast." msgstr "" -#: ../../c-api/long.rst:466 +#: ../../c-api/long.rst:464 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" -#: ../../c-api/long.rst:469 +#: ../../c-api/long.rst:467 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:471 +#: ../../c-api/long.rst:469 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:473 +#: ../../c-api/long.rst:471 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:475 +#: ../../c-api/long.rst:473 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -504,26 +499,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:489 +#: ../../c-api/long.rst:487 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" -#: ../../c-api/long.rst:496 +#: ../../c-api/long.rst:494 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" -#: ../../c-api/long.rst:499 +#: ../../c-api/long.rst:497 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" -#: ../../c-api/long.rst:502 +#: ../../c-api/long.rst:500 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -554,69 +549,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:530 +#: ../../c-api/long.rst:528 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:535 +#: ../../c-api/long.rst:533 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:541 +#: ../../c-api/long.rst:539 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:541 +#: ../../c-api/long.rst:539 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:543 +#: ../../c-api/long.rst:541 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:544 +#: ../../c-api/long.rst:542 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:545 +#: ../../c-api/long.rst:543 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:546 +#: ../../c-api/long.rst:544 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:547 +#: ../../c-api/long.rst:545 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:548 +#: ../../c-api/long.rst:546 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:549 +#: ../../c-api/long.rst:547 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:552 +#: ../../c-api/long.rst:550 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:555 +#: ../../c-api/long.rst:553 msgid "" "By default, sufficient buffer will be requested to include a sign bit. For " "example, when converting 128 with *n_bytes=1*, the function will return 2 " "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:559 +#: ../../c-api/long.rst:557 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -626,7 +621,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:566 +#: ../../c-api/long.rst:564 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -634,7 +629,7 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:571 +#: ../../c-api/long.rst:569 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " @@ -644,7 +639,7 @@ msgid "" "`TypeError`." msgstr "" -#: ../../c-api/long.rst:580 +#: ../../c-api/long.rst:578 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -652,88 +647,88 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:591 +#: ../../c-api/long.rst:589 msgid "Macro for converting a Python integer into a process identifier." msgstr "" -#: ../../c-api/long.rst:593 +#: ../../c-api/long.rst:591 msgid "" "This can be defined as an alias to :c:func:`PyLong_AsLong`, :c:func:" "`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the size of " "the system's PID type." msgstr "" -#: ../../c-api/long.rst:602 +#: ../../c-api/long.rst:600 msgid "Get the sign of the integer object *obj*." msgstr "" -#: ../../c-api/long.rst:604 +#: ../../c-api/long.rst:602 msgid "" "On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " "negative or positive integer, respectively) and return 0." msgstr "" -#: ../../c-api/long.rst:607 +#: ../../c-api/long.rst:605 msgid "" "On failure, return -1 with an exception set. This function always succeeds " "if *obj* is a :c:type:`PyLongObject` or its subtype." msgstr "" -#: ../../c-api/long.rst:615 +#: ../../c-api/long.rst:613 msgid "Check if the integer object *obj* is positive (``obj > 0``)." msgstr "檢查整數物件 *obj* 是否為正(``obj > 0``)。" -#: ../../c-api/long.rst:617 +#: ../../c-api/long.rst:615 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's positive and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為正數時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為正數時回傳 " +"``1``,否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:626 +#: ../../c-api/long.rst:624 msgid "Check if the integer object *obj* is negative (``obj < 0``)." msgstr "檢查整數物件 *obj* 是否為負(``obj < 0``)。" -#: ../../c-api/long.rst:628 +#: ../../c-api/long.rst:626 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's negative and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為負數時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為負數時回傳 " +"``1``,否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:637 +#: ../../c-api/long.rst:635 msgid "Check if the integer object *obj* is zero." msgstr "檢查整數物件 *obj* 是否為零。" -#: ../../c-api/long.rst:639 +#: ../../c-api/long.rst:637 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's zero and ``0`` otherwise. Else set an exception and return " "``-1``." msgstr "" -"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為零時回傳 ``1``,否則" -"回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" +"如果 *obj* 是 :c:type:`PyLongObject` 或其子類別的實例,當它為零時回傳 ``1``," +"否則回傳 ``0``。其餘情況則設定例外並回傳 ``-1``。" -#: ../../c-api/long.rst:648 +#: ../../c-api/long.rst:646 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:652 +#: ../../c-api/long.rst:650 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:659 +#: ../../c-api/long.rst:657 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:661 +#: ../../c-api/long.rst:659 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" @@ -741,93 +736,93 @@ msgid "" "`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:667 +#: ../../c-api/long.rst:665 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:669 +#: ../../c-api/long.rst:667 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:677 +#: ../../c-api/long.rst:675 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:680 +#: ../../c-api/long.rst:678 msgid "Otherwise, the return value is undefined." msgstr "" -#: ../../c-api/long.rst:686 +#: ../../c-api/long.rst:684 msgid "Export API" msgstr "匯出 API" -#: ../../c-api/long.rst:692 +#: ../../c-api/long.rst:690 msgid "" "Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " "represent absolute value for arbitrary precision integers." msgstr "" -#: ../../c-api/long.rst:695 +#: ../../c-api/long.rst:693 msgid "" "Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :" "class:`int` objects, used internally for integers with \"big enough\" " "absolute value." msgstr "" -#: ../../c-api/long.rst:699 +#: ../../c-api/long.rst:697 msgid "" "See also :data:`sys.int_info` which exposes similar information in Python." msgstr "" -#: ../../c-api/long.rst:703 +#: ../../c-api/long.rst:701 msgid "" "Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " "meaningful information." msgstr "" -#: ../../c-api/long.rst:708 +#: ../../c-api/long.rst:706 msgid "" "Digit size in bytes. For example, a 15 bit digit will require at least 2 " "bytes." msgstr "" -#: ../../c-api/long.rst:713 +#: ../../c-api/long.rst:711 msgid "Digits order:" msgstr "" -#: ../../c-api/long.rst:715 +#: ../../c-api/long.rst:713 msgid "``1`` for most significant digit first" msgstr "" -#: ../../c-api/long.rst:716 +#: ../../c-api/long.rst:714 msgid "``-1`` for least significant digit first" msgstr "" -#: ../../c-api/long.rst:720 +#: ../../c-api/long.rst:718 msgid "Digit endianness:" msgstr "" -#: ../../c-api/long.rst:722 +#: ../../c-api/long.rst:720 msgid "``1`` for most significant byte first (big endian)" msgstr "" -#: ../../c-api/long.rst:723 +#: ../../c-api/long.rst:721 msgid "``-1`` for least significant byte first (little endian)" msgstr "" -#: ../../c-api/long.rst:728 +#: ../../c-api/long.rst:726 msgid "Get the native layout of Python :class:`int` objects." msgstr "" -#: ../../c-api/long.rst:730 +#: ../../c-api/long.rst:728 msgid "See the :c:struct:`PyLongLayout` structure." msgstr "請見 :c:struct:`PyLongLayout` 結構。" -#: ../../c-api/long.rst:732 +#: ../../c-api/long.rst:730 msgid "" "The function must not be called before Python initialization nor after " "Python finalization. The returned layout is valid until Python is finalized. " @@ -835,128 +830,128 @@ msgid "" "it can be cached." msgstr "" -#: ../../c-api/long.rst:740 +#: ../../c-api/long.rst:738 msgid "Export of a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:742 +#: ../../c-api/long.rst:740 msgid "There are two cases:" msgstr "" -#: ../../c-api/long.rst:744 +#: ../../c-api/long.rst:742 msgid "" "If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." msgstr "" -#: ../../c-api/long.rst:745 +#: ../../c-api/long.rst:743 msgid "" "If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:" "`ndigits` and :c:member:`digits` members." msgstr "" -#: ../../c-api/long.rst:750 +#: ../../c-api/long.rst:748 msgid "" "The native integer value of the exported :class:`int` object. Only valid if :" "c:member:`digits` is ``NULL``." msgstr "" -#: ../../c-api/long.rst:755 +#: ../../c-api/long.rst:753 msgid "" "``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:760 +#: ../../c-api/long.rst:758 msgid "" "Number of digits in :c:member:`digits` array. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" -#: ../../c-api/long.rst:765 +#: ../../c-api/long.rst:763 msgid "Read-only array of unsigned digits. Can be ``NULL``." msgstr "" -#: ../../c-api/long.rst:770 +#: ../../c-api/long.rst:768 msgid "Export a Python :class:`int` object." msgstr "" -#: ../../c-api/long.rst:772 +#: ../../c-api/long.rst:770 msgid "" "*export_long* must point to a :c:struct:`PyLongExport` structure allocated " "by the caller. It must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:775 +#: ../../c-api/long.rst:773 msgid "" "On success, fill in *\\*export_long* and return ``0``. On error, set an " "exception and return ``-1``." msgstr "" -#: ../../c-api/long.rst:778 +#: ../../c-api/long.rst:776 msgid "" ":c:func:`PyLong_FreeExport` must be called when the export is no longer " "needed." msgstr "" -#: ../../c-api/long.rst:782 +#: ../../c-api/long.rst:780 msgid "" "This function always succeeds if *obj* is a Python :class:`int` object or a " "subclass." msgstr "" -#: ../../c-api/long.rst:788 +#: ../../c-api/long.rst:786 msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/long.rst:791 +#: ../../c-api/long.rst:789 msgid "" "Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " "``NULL``." msgstr "" -#: ../../c-api/long.rst:796 +#: ../../c-api/long.rst:794 msgid "PyLongWriter API" msgstr "PyLongWriter API" -#: ../../c-api/long.rst:798 +#: ../../c-api/long.rst:796 msgid "The :c:type:`PyLongWriter` API can be used to import an integer." msgstr "" -#: ../../c-api/long.rst:804 +#: ../../c-api/long.rst:802 msgid "A Python :class:`int` writer instance." msgstr "" -#: ../../c-api/long.rst:806 +#: ../../c-api/long.rst:804 msgid "" "The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:" "`PyLongWriter_Discard`." msgstr "" -#: ../../c-api/long.rst:812 +#: ../../c-api/long.rst:810 msgid "Create a :c:type:`PyLongWriter`." msgstr "建立一個 :c:type:`PyLongWriter`。" -#: ../../c-api/long.rst:814 +#: ../../c-api/long.rst:812 msgid "" "On success, allocate *\\*digits* and return a writer. On error, set an " "exception and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:817 +#: ../../c-api/long.rst:815 msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." msgstr "" -#: ../../c-api/long.rst:819 +#: ../../c-api/long.rst:817 msgid "" "*ndigits* is the number of digits in the *digits* array. It must be greater " "than 0." msgstr "" -#: ../../c-api/long.rst:822 +#: ../../c-api/long.rst:820 msgid "*digits* must not be NULL." msgstr "*digits* 不得為 NULL。" -#: ../../c-api/long.rst:824 +#: ../../c-api/long.rst:822 msgid "" "After a successful call to this function, the caller should fill in the " "array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " @@ -964,83 +959,85 @@ msgid "" "`PyLong_GetNativeLayout`." msgstr "" -#: ../../c-api/long.rst:829 +#: ../../c-api/long.rst:827 msgid "" "Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " "the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " "digit). Any unused most significant digits must be set to ``0``." msgstr "" -#: ../../c-api/long.rst:834 +#: ../../c-api/long.rst:832 msgid "" "Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " "instance without creating an :class:`~int` object." msgstr "" -#: ../../c-api/long.rst:840 +#: ../../c-api/long.rst:838 msgid "" "Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" -#: ../../c-api/long.rst:842 +#: ../../c-api/long.rst:840 msgid "" "On success, return a Python :class:`int` object. On error, set an exception " "and return ``NULL``." msgstr "" -#: ../../c-api/long.rst:845 +#: ../../c-api/long.rst:843 msgid "" "The function takes care of normalizing the digits and converts the object to " "a compact integer if needed." msgstr "" -#: ../../c-api/long.rst:848 ../../c-api/long.rst:857 +#: ../../c-api/long.rst:846 ../../c-api/long.rst:855 msgid "The writer instance and the *digits* array are invalid after the call." msgstr "" -#: ../../c-api/long.rst:853 +#: ../../c-api/long.rst:851 msgid "" "Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "丟棄由 :c:func:`PyLongWriter_Create` 建立的 :c:type:`PyLongWriter`。" -#: ../../c-api/long.rst:855 +#: ../../c-api/long.rst:853 msgid "If *writer* is ``NULL``, no operation is performed." msgstr "如果 *writer* 為 ``NULL``,則不執行任何操作。" -#: ../../c-api/long.rst:861 +#: ../../c-api/long.rst:859 msgid "Deprecated API" msgstr "已棄用的 API" -#: ../../c-api/long.rst:863 +#: ../../c-api/long.rst:861 msgid "" "These macros are :term:`soft deprecated`. They describe parameters of the " "internal representation of :c:type:`PyLongObject` instances." msgstr "" -"這些巨集已被\\ :term:`軟性棄用 `。它們描述了 :c:type:`PyLongObject` " -"實例的內部表示參數。" +"這些巨集已被\\ :term:`軟性棄用 `。它們描述了 :c:type:" +"`PyLongObject` 實例的內部表示參數。" -#: ../../c-api/long.rst:866 +#: ../../c-api/long.rst:864 msgid "" "Use :c:func:`PyLong_GetNativeLayout` instead, along with :c:func:" "`PyLong_Export` to read integer data or :c:type:`PyLongWriter` to write it. " "These currently use the same layout, but are designed to continue working " "correctly even if CPython's internal integer representation changes." msgstr "" -"請改用 :c:func:`PyLong_GetNativeLayout`,並與 :c:func:`PyLong_Export` 使用來讀取整數資料," -"或者 :c:type:`PyLongWriter` 來寫入它們。它們目前使用相同的佈局,不過即使 CPython 的內部整數表" -"示發生變化,也能繼續正確運作。" +"請改用 :c:func:`PyLong_GetNativeLayout`,並與 :c:func:`PyLong_Export` 使用來" +"讀取整數資料,或者 :c:type:`PyLongWriter` 來寫入它們。它們目前使用相同的佈" +"局,不過即使 CPython 的內部整數表示發生變化,也能繼續正確運作。" -#: ../../c-api/long.rst:874 +#: ../../c-api/long.rst:872 msgid "" "This is equivalent to :c:member:`~PyLongLayout.bits_per_digit` in the output " "of :c:func:`PyLong_GetNativeLayout`." -msgstr "這等同於 :c:func:`PyLong_GetNativeLayout` 輸出中的 :c:member:`~PyLongLayout.bits_per_digit`。" +msgstr "" +"這等同於 :c:func:`PyLong_GetNativeLayout` 輸出中的 :c:member:`~PyLongLayout." +"bits_per_digit`。" -#: ../../c-api/long.rst:880 +#: ../../c-api/long.rst:878 msgid "This is currently equivalent to :c:expr:`1 << PyLong_SHIFT`." msgstr "這目前等同於 :c:expr:`1 << PyLong_SHIFT`。" -#: ../../c-api/long.rst:885 +#: ../../c-api/long.rst:883 msgid "This is currently equivalent to :c:expr:`(1 << PyLong_SHIFT) - 1`" msgstr "這目前等同於 :c:expr:`(1 << PyLong_SHIFT) - 1`" @@ -1060,19 +1057,19 @@ msgstr "integer(整數)" msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:177 ../../c-api/long.rst:237 ../../c-api/long.rst:280 -#: ../../c-api/long.rst:295 ../../c-api/long.rst:311 ../../c-api/long.rst:327 +#: ../../c-api/long.rst:177 ../../c-api/long.rst:235 ../../c-api/long.rst:278 +#: ../../c-api/long.rst:293 ../../c-api/long.rst:309 ../../c-api/long.rst:325 msgid "OverflowError (built-in exception)" msgstr "OverflowError(內建例外)" -#: ../../c-api/long.rst:280 +#: ../../c-api/long.rst:278 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:295 +#: ../../c-api/long.rst:293 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:311 +#: ../../c-api/long.rst:309 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/module.po b/c-api/module.po index 17aee4df65..b6fbb54bf0 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: 2026-02-24 00:20+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -703,25 +703,20 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:609 -msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." -msgstr "" -":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" - -#: ../../c-api/module.rst:614 +#: ../../c-api/module.rst:612 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:618 +#: ../../c-api/module.rst:616 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:624 +#: ../../c-api/module.rst:622 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 " @@ -729,14 +724,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:629 +#: ../../c-api/module.rst:627 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:636 +#: ../../c-api/module.rst:634 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 " @@ -744,11 +739,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:644 +#: ../../c-api/module.rst:642 msgid "Add a string constant to *module*." msgstr "將字串常數加入到 *module* 中。" -#: ../../c-api/module.rst:648 +#: ../../c-api/module.rst:646 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 " @@ -756,7 +751,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:658 +#: ../../c-api/module.rst:656 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -765,7 +760,7 @@ msgid "" "first parameter, making them similar to instance methods on Python classes)." msgstr "" -#: ../../c-api/module.rst:664 +#: ../../c-api/module.rst:662 msgid "" "This function is called automatically when creating a module from " "``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " @@ -774,13 +769,13 @@ msgid "" "that case they should call this function directly." msgstr "" -#: ../../c-api/module.rst:671 +#: ../../c-api/module.rst:669 msgid "" "The *functions* array must be statically allocated (or otherwise guaranteed " "to outlive the module object)." msgstr "" -#: ../../c-api/module.rst:678 +#: ../../c-api/module.rst:676 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef`` (such as when " @@ -788,11 +783,11 @@ msgid "" "``PyModule_FromDefAndSpec``)." msgstr "" -#: ../../c-api/module.rst:683 +#: ../../c-api/module.rst:681 msgid "Return ``0`` on success. Return ``-1`` with an exception set on error." msgstr "成功時回傳 ``0``。在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:690 +#: ../../c-api/module.rst:688 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`. " @@ -804,11 +799,11 @@ msgid "" "on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:704 +#: ../../c-api/module.rst:702 msgid "Module lookup (single-phase initialization)" msgstr "" -#: ../../c-api/module.rst:706 +#: ../../c-api/module.rst:704 msgid "" "The legacy :ref:`single-phase initialization ` " "initialization scheme creates singleton modules that can be looked up in the " @@ -816,14 +811,14 @@ msgid "" "retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:711 +#: ../../c-api/module.rst:709 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:716 +#: ../../c-api/module.rst:714 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -832,18 +827,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:723 +#: ../../c-api/module.rst:721 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:726 +#: ../../c-api/module.rst:724 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:728 +#: ../../c-api/module.rst:726 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module " "that uses :ref:`single-phase initialization `, " @@ -855,21 +850,21 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:737 +#: ../../c-api/module.rst:735 msgid "" "If a module was attached previously using the same *def*, it is replaced by " "the new *module*." msgstr "" -#: ../../c-api/module.rst:740 ../../c-api/module.rst:751 +#: ../../c-api/module.rst:738 ../../c-api/module.rst:749 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/module.rst:742 +#: ../../c-api/module.rst:740 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:748 +#: ../../c-api/module.rst:746 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -914,3 +909,7 @@ msgstr "__dict__(模組屬性)" #: ../../c-api/module.rst:80 ../../c-api/module.rst:119 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" + +#~ msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." +#~ msgstr "" +#~ ":c:func:`PyModule_AddObject` 已被\\ :term:`軟性棄用 `。" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 8c2bc0c80c..3cdc4026b1 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,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: 2026-04-23 00:30+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -296,7 +296,3 @@ msgid "" "Return true if the event corresponding to the event ID *ev* is a :ref:`local " "event `." msgstr "" - -#: ../../c-api/monitoring.rst:210 -msgid "This function is :term:`soft deprecated`." -msgstr "" diff --git a/c-api/sequence.po b/c-api/sequence.po index 912fea56bf..57f91522de 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-04-23 00:30+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-" @@ -24,10 +24,10 @@ msgstr "序列協定" #: ../../c-api/sequence.rst:11 msgid "" "Return ``1`` if the object provides the sequence protocol, and ``0`` " -"otherwise. Note that it returns ``1`` for Python classes with " -"a :meth:`~object.__getitem__` method, unless they are :class:`dict` " -"subclasses, since in general it is impossible to determine what type of keys " -"the class supports. This function always succeeds." +"otherwise. Note that it returns ``1`` for Python classes with a :meth:" +"`~object.__getitem__` method, unless they are :class:`dict` subclasses, " +"since in general it is impossible to determine what type of keys the class " +"supports. This function always succeeds." msgstr "" #: ../../c-api/sequence.rst:23 @@ -126,25 +126,23 @@ msgid "Alias for :c:func:`PySequence_Contains`." msgstr ":c:func:`PySequence_Contains` 的別名。" #: ../../c-api/sequence.rst:112 -msgid "" -"The function is :term:`soft deprecated` and should no longer be used to " -"write new code." +msgid "The function should no longer be used to write new code." msgstr "" -#: ../../c-api/sequence.rst:119 +#: ../../c-api/sequence.rst:118 msgid "" "Return the first index *i* for which ``o[i] == value``. On error, return " "``-1``. This is equivalent to the Python expression ``o.index(value)``." msgstr "" -#: ../../c-api/sequence.rst:125 +#: ../../c-api/sequence.rst:124 msgid "" "Return a list object with the same contents as the sequence or iterable *o*, " "or ``NULL`` on failure. The returned list is guaranteed to be new. This is " "equivalent to the Python expression ``list(o)``." msgstr "" -#: ../../c-api/sequence.rst:134 +#: ../../c-api/sequence.rst:133 msgid "" "Return a tuple object with the same contents as the sequence or iterable " "*o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be " @@ -152,7 +150,7 @@ msgid "" "contents. This is equivalent to the Python expression ``tuple(o)``." msgstr "" -#: ../../c-api/sequence.rst:142 +#: ../../c-api/sequence.rst:141 msgid "" "Return the sequence or iterable *o* as an object usable by the other " "``PySequence_Fast*`` family of functions. If the object is not a sequence or " @@ -160,57 +158,56 @@ msgid "" "``NULL`` on failure." msgstr "" -#: ../../c-api/sequence.rst:147 +#: ../../c-api/sequence.rst:146 msgid "" "The ``PySequence_Fast*`` functions are thus named because they assume *o* is " "a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data " "fields of *o* directly." msgstr "" -#: ../../c-api/sequence.rst:151 +#: ../../c-api/sequence.rst:150 msgid "" "As a CPython implementation detail, if *o* is already a sequence or list, it " "will be returned." msgstr "" -#: ../../c-api/sequence.rst:157 +#: ../../c-api/sequence.rst:156 msgid "" -"Returns the length of *o*, assuming that *o* was returned " -"by :c:func:`PySequence_Fast` and that *o* is not ``NULL``. The size can " -"also be retrieved by calling :c:func:`PySequence_Size` on *o*, " -"but :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* " -"is a list or tuple." +"Returns the length of *o*, assuming that *o* was returned by :c:func:" +"`PySequence_Fast` and that *o* is not ``NULL``. The size can also be " +"retrieved by calling :c:func:`PySequence_Size` on *o*, but :c:func:" +"`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or " +"tuple." msgstr "" -#: ../../c-api/sequence.rst:166 +#: ../../c-api/sequence.rst:165 msgid "" -"Return the *i*\\ th element of *o*, assuming that *o* was returned " -"by :c:func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within " -"bounds." +"Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:" +"func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." msgstr "" -#: ../../c-api/sequence.rst:172 +#: ../../c-api/sequence.rst:171 msgid "" "Return the underlying array of PyObject pointers. Assumes that *o* was " "returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -#: ../../c-api/sequence.rst:175 +#: ../../c-api/sequence.rst:174 msgid "" "Note, if a list gets resized, the reallocation may relocate the items array. " "So, only use the underlying array pointer in contexts where the sequence " "cannot change." msgstr "" -#: ../../c-api/sequence.rst:182 +#: ../../c-api/sequence.rst:181 msgid "" -"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form " -"of :c:func:`PySequence_GetItem` but without checking " -"that :c:func:`PySequence_Check` on *o* is true and without adjustment for " -"negative indices." +"Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:" +"func:`PySequence_GetItem` but without checking that :c:func:" +"`PySequence_Check` on *o* is true and without adjustment for negative " +"indices." msgstr "" -#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:132 +#: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:131 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -218,6 +215,6 @@ msgstr "built-in function(內建函式)" msgid "len" msgstr "len" -#: ../../c-api/sequence.rst:132 +#: ../../c-api/sequence.rst:131 msgid "tuple" msgstr "tuple(元組)" diff --git a/howto/descriptor.po b/howto/descriptor.po index 9df80d6e37..cbf84ee223 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-09 05:11+0800\n" +"POT-Creation-Date: 2026-05-02 00:31+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -81,14 +81,13 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools " -"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " -"and :term:`__slots__`." +"bound methods or about the implementation of common tools like :func:" +"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." msgstr "" "最後一個章節提供以 C 語言撰寫的內建描述器的純 Python 等價實作。如果你好奇函式" -"如何轉變為綁定方法,或者想了解常見工具" -"如 :func:`classmethod`、:func:`staticmethod`、:func:`property` " -"和 :term:`__slots__` 的實作方式,請閱讀此章節。" +"如何轉變為綁定方法,或者想了解常見工具如 :func:`classmethod`、:func:" +"`staticmethod`、:func:`property` 和 :term:`__slots__` 的實作方式,請閱讀此章" +"節。" #: ../../howto/descriptor.rst:36 msgid "Primer" @@ -284,9 +283,8 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` " -"and :meth:`~object.__set__` methods are triggered when the public attribute " -"is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." +"__set__` methods are triggered when the public attribute is accessed." msgstr "" "描述器的一個常見用途是管理對實例資料的存取。描述器被指派給類別字典中的公開屬" "性,而實際資料則儲存為實例字典中的私有屬性。當存取公開屬性時,會觸發描述器" @@ -445,9 +443,9 @@ msgid "" "*private_name*:" msgstr "" "在這個範例中,:class:`!Person` 類別有兩個描述器實例:*name* 和 *age*。當定" -"義 :class:`!Person` 類別時,它會對 *LoggedAccess* 中" -"的 :meth:`~object.__set_name__` 進行回呼,以便記錄欄位名稱,讓每個描述器都有" -"自己的 *public_name* 和 *private_name*:" +"義 :class:`!Person` 類別時,它會對 *LoggedAccess* 中的 :meth:`~object." +"__set_name__` 進行回呼,以便記錄欄位名稱,讓每個描述器都有自己的 " +"*public_name* 和 *private_name*:" #: ../../howto/descriptor.rst:223 msgid "" @@ -515,10 +513,9 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`!Person` class has " -"called :meth:`~object.__set_name__` so that the field names would be " -"recorded. Here we call :func:`vars` to look up the descriptor without " -"triggering it:" +"An interactive session shows that the :class:`!Person` class has called :" +"meth:`~object.__set_name__` so that the field names would be recorded. Here " +"we call :func:`vars` to look up the descriptor without triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -575,13 +572,11 @@ msgstr "結語" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that " -"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " -"or :meth:`~object.__delete__`." +"A :term:`descriptor` is what we call any object that defines :meth:`~object." +"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." msgstr "" -":term:`描述器 ` 是我們對任何定義" -"了 :meth:`~object.__get__`、:meth:`~object.__set__` " -"或 :meth:`~object.__delete__` 的物件的稱呼。" +":term:`描述器 ` 是我們對任何定義了 :meth:`~object.__get__`、:" +"meth:`~object.__set__` 或 :meth:`~object.__delete__` 的物件的稱呼。" #: ../../howto/descriptor.rst:300 msgid "" @@ -629,13 +624,13 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools " -"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " -"and :func:`functools.cached_property` are all implemented as descriptors." +"bound methods. Common tools like :func:`classmethod`, :func:" +"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " +"all implemented as descriptors." msgstr "" "描述器在整個語言中被廣泛使用。函式就是透過這種方式轉變為綁定方法。常見工具" -"如 :func:`classmethod`、:func:`staticmethod`、:func:`property` " -"和 :func:`functools.cached_property` 都是以描述器實作的。" +"如 :func:`classmethod`、:func:`staticmethod`、:func:`property` 和 :func:" +"`functools.cached_property` 都是以描述器實作的。" #: ../../howto/descriptor.rst:326 msgid "Complete Practical Example" @@ -733,9 +728,9 @@ msgstr ":class:`!OneOf` 驗證數值是否為限制選項集合中的其中一 #: ../../howto/descriptor.rst:374 msgid "" -":class:`!Number` verifies that a value is either an :class:`int` " -"or :class:`float`. Optionally, it verifies that a value is between a given " -"minimum or maximum." +":class:`!Number` verifies that a value is either an :class:`int` or :class:" +"`float`. Optionally, it verifies that a value is between a given minimum or " +"maximum." msgstr "" ":class:`!Number` 驗證數值是否為 :class:`int` 或 :class:`float`。可選地,它會" "驗證數值是否在給定的最小值或最大值之間。" @@ -917,15 +912,13 @@ msgstr "定義與介紹" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods " -"are :meth:`~object.__get__`, :meth:`~object.__set__`, " -"and :meth:`~object.__delete__`. If any of those methods are defined for an " -"attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" +"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " +"methods are defined for an attribute, it is said to be a :term:`descriptor`." msgstr "" -"一般來說,描述器是具有描述器協定中某個方法的屬性值。這些方法包" -"括 :meth:`~object.__get__`、:meth:`~object.__set__` " -"和 :meth:`~object.__delete__`。如果為屬性定義了其中任何一個方法,就稱" -"為 :term:`描述器 `。" +"一般來說,描述器是具有描述器協定中某個方法的屬性值。這些方法包括 :meth:" +"`~object.__get__`、:meth:`~object.__set__` 和 :meth:`~object.__delete__`。如" +"果為屬性定義了其中任何一個方法,就稱為 :term:`描述器 `。" #: ../../howto/descriptor.rst:508 msgid "" @@ -947,14 +940,14 @@ msgstr "" #: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, " -"and :func:`super`. They are used throughout Python itself. Descriptors " -"simplify the underlying C code and offer a flexible set of new tools for " -"everyday Python programs." +"mechanism behind properties, methods, static methods, class methods, and :" +"func:`super`. They are used throughout Python itself. Descriptors simplify " +"the underlying C code and offer a flexible set of new tools for everyday " +"Python programs." msgstr "" -"描述器是強大且通用的協定。它們是屬性、方法、靜態方法、類別方法" -"和 :func:`super` 背後的機制。它們在 Python 本身中廣泛使用。描述器簡化了底層 " -"C 程式碼,並為日常 Python 程式提供靈活的新工具集。" +"描述器是強大且通用的協定。它們是屬性、方法、靜態方法、類別方法和 :func:" +"`super` 背後的機制。它們在 Python 本身中廣泛使用。描述器簡化了底層 C 程式碼," +"並為日常 Python 程式提供靈活的新工具集。" #: ../../howto/descriptor.rst:525 msgid "Descriptor protocol" @@ -984,9 +977,9 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " -"it is considered a data descriptor. Descriptors that only " -"define :meth:`~object.__get__` are called non-data descriptors (they are " -"often used for methods but other uses are possible)." +"it is considered a data descriptor. Descriptors that only define :meth:" +"`~object.__get__` are called non-data descriptors (they are often used for " +"methods but other uses are possible)." msgstr "" "如果物件定義了 :meth:`~object.__set__` 或 :meth:`~object.__delete__`,它被視" "為資料描述器。只定義 :meth:`~object.__get__` 的描述器稱為非資料描述器(它們通" @@ -1007,15 +1000,13 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " -"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " -"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " -"method with an exception raising placeholder is enough to make it a data " -"descriptor." +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" +"`AttributeError` when called. Defining the :meth:`~object.__set__` method " +"with an exception raising placeholder is enough to make it a data descriptor." msgstr "" -"要建立唯讀資料描述器,定義 :meth:`~object.__get__` " -"和 :meth:`~object.__set__`,並讓 :meth:`~object.__set__` 在被呼叫時引" -"發 :exc:`AttributeError`。定義引發例外佔位符的 :meth:`~object.__set__` 方法就" -"足以讓它成為資料描述器。" +"要建立唯讀資料描述器,定義 :meth:`~object.__get__` 和 :meth:`~object." +"__set__`,並讓 :meth:`~object.__set__` 在被呼叫時引發 :exc:`AttributeError`。" +"定義引發例外佔位符的 :meth:`~object.__set__` 方法就足以讓它成為資料描述器。" #: ../../howto/descriptor.rst:555 msgid "Overview of descriptor invocation" @@ -1023,8 +1014,8 @@ msgstr "描述器呼叫概觀" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or " -"``desc.__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." +"__get__(None, cls)``." msgstr "" "描述器可以直接使用 ``desc.__get__(obj)`` 或 ``desc.__get__(None, cls)`` 呼" "叫。" @@ -1065,8 +1056,8 @@ msgstr "" #: ../../howto/descriptor.rst:580 msgid "" -"If a descriptor is found for ``a.x``, then it is invoked with: " -"``desc.__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." +"__get__(a, type(a))``." msgstr "" "如果為 ``a.x`` 找到描述器,則使用 ``desc.__get__(a, type(a))`` 呼叫它。" @@ -1108,19 +1099,18 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`~object.__getattr__` hook in " -"the :meth:`~object.__getattribute__` code. That is why " -"calling :meth:`~object.__getattribute__` directly or with " -"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " -"entirely." +"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." +"__getattribute__` code. That is why calling :meth:`~object." +"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" +"meth:`~object.__getattr__` entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`~object.__getattr__` " -"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " -"Their logic is encapsulated in a helper function:" +"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." +"__getattribute__` raises an :exc:`AttributeError`. Their logic is " +"encapsulated in a helper function:" msgstr "" #: ../../howto/descriptor.rst:731 @@ -1149,10 +1139,10 @@ msgstr "從類別呼叫" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" -"type.__getattribute__`. The steps are similar to those for :meth:`!" -"object.__getattribute__` but the instance dictionary lookup is replaced by a " -"search through the class's :term:`method resolution order`." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." +"__getattribute__`. The steps are similar to those for :meth:`!object." +"__getattribute__` but the instance dictionary lookup is replaced by a search " +"through the class's :term:`method resolution order`." msgstr "" #: ../../howto/descriptor.rst:783 @@ -1161,8 +1151,8 @@ msgstr "如果找到描述器,則使用 ``desc.__get__(None, A)`` 呼叫它。 #: ../../howto/descriptor.rst:785 msgid "" -"The full C implementation can be found in :c:func:`!type_getattro` " -"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +"The full C implementation can be found in :c:func:`!type_getattro` and :c:" +"func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" #: ../../howto/descriptor.rst:790 @@ -1171,23 +1161,22 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in " -"the :meth:`~object.__getattribute__` method for object returned " -"by :func:`super`." +"The logic for super's dotted lookup is in the :meth:`~object." +"__getattribute__` method for object returned by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 msgid "" -"A dotted lookup such as ``super(A, obj).m`` searches " -"``obj.__class__.__mro__`` for the base class ``B`` immediately following " -"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " -"descriptor, ``m`` is returned unchanged." +"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." +"__mro__`` for the base class ``B`` immediately following ``A`` and then " +"returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " +"returned unchanged." msgstr "" #: ../../howto/descriptor.rst:800 msgid "" -"The full C implementation can be found in :c:func:`!super_getattro` " -"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` in :" +"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial `_." msgstr "" @@ -1198,9 +1187,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in " -"the :meth:`~object.__getattribute__` methods " -"for :class:`object`, :class:`type`, and :func:`super`." +"The mechanism for descriptors is embedded in the :meth:`~object." +"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" +"`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -1213,8 +1202,8 @@ msgstr "" #: ../../howto/descriptor.rst:816 msgid "" -"Classes inherit this machinery from :class:`object`, :class:`type`, " -"or :func:`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" +"`super`." msgstr "" #: ../../howto/descriptor.rst:819 @@ -1273,8 +1262,8 @@ msgstr "ORM 範例" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping `_." +"could be used to implement an `object relational mapping `_." msgstr "" #: ../../howto/descriptor.rst:857 @@ -1318,9 +1307,9 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`!Field` class to define `models `_ that describe the schema for each " -"table in a database:" +"We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a " +"database:" msgstr "" #: ../../howto/descriptor.rst:880 @@ -1577,10 +1566,10 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" -"To support automatic creation of methods, functions include " -"the :meth:`~object.__get__` method for binding methods during attribute " -"access. This means that functions are non-data descriptors that return " -"bound methods during dotted lookup from an instance. Here's how it works:" +"To support automatic creation of methods, functions include the :meth:" +"`~object.__get__` method for binding methods during attribute access. This " +"means that functions are non-data descriptors that return bound methods " +"during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1632,9 +1621,8 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" -"Accessing the function through the class dictionary does not " -"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " -"function object::" +"Accessing the function through the class dictionary does not invoke :meth:" +"`~object.__get__`. Instead, it just returns the underlying function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1771,10 +1759,10 @@ msgstr "" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " -"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " -"\"f\")``. As a result, the function becomes identically accessible from " -"either an object or a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." +"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " +"result, the function becomes identically accessible from either an object or " +"a class." msgstr "" #: ../../howto/descriptor.rst:1299 @@ -1827,8 +1815,8 @@ msgstr "" #: ../../howto/descriptor.rst:1328 msgid "" -"Using the non-data descriptor protocol, a pure Python version " -"of :func:`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version of :func:" +"`staticmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1331 @@ -1858,8 +1846,8 @@ msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " "attributes necessary to make the wrapper look like the wrapped function, " -"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, " -"and :attr:`~function.__doc__`." +"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, and :" +"attr:`~function.__doc__`." msgstr "" #: ../../howto/descriptor.rst:1421 @@ -1938,8 +1926,8 @@ msgstr "" #: ../../howto/descriptor.rst:1468 msgid "" -"Using the non-data descriptor protocol, a pure Python version " -"of :func:`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version of :func:" +"`classmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1471 @@ -1964,9 +1952,9 @@ msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped " -"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " -"and :attr:`~function.__annotations__`." +"wrapped function: :attr:`~function.__name__`, :attr:`~function." +"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." +"__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1542 @@ -2122,7 +2110,7 @@ msgid "" "class Member:\n" "\n" " def __init__(self, name, clsname, offset):\n" -" 'Emulate PyMemberDef in Include/structmember.h'\n" +" 'Emulate PyMemberDef in Include/descrobject.h'\n" " # Also see descr_new() in Objects/descrobject.c\n" " self.name = name\n" " self.clsname = clsname\n" diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index fbb9971737..a8c1c4f599 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-07 00:14+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -672,23 +672,20 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:397 msgid "" "`pypa/manylinux `_ supports the free-" -"threaded build, with the ``t`` suffix, such as ``python3.13t``." +"threaded build, with the ``t`` suffix, such as ``python3.14t``." msgstr "" #: ../../howto/free-threading-extensions.rst:399 msgid "" -"`pypa/cibuildwheel `_ supports the " -"free-threaded build on Python 3.13 and 3.14. On Python 3.14, free-threaded " -"wheels will be built by default. On Python 3.13, you will need to set " -"`CIBW_ENABLE to cpython-freethreading `_." +"`pypa/cibuildwheel `_ supports " +"building wheels for the free-threaded build of Python 3.14 and newer." msgstr "" -#: ../../howto/free-threading-extensions.rst:405 +#: ../../howto/free-threading-extensions.rst:403 msgid "Limited C API and Stable ABI" msgstr "" -#: ../../howto/free-threading-extensions.rst:407 +#: ../../howto/free-threading-extensions.rst:405 msgid "" "The free-threaded build does not currently support the :ref:`Limited C API " "` or the stable ABI. If you use `setuptools `_: A community-maintained porting guide for " diff --git a/library/calendar.po b/library/calendar.po index 8f2769095b..0cba01ab28 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-04-28 00:31+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -99,7 +99,7 @@ msgstr "" #: ../../library/calendar.rst:59 msgid "" -"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)." msgstr "" #: ../../library/calendar.rst:61 @@ -108,7 +108,7 @@ msgstr "" #: ../../library/calendar.rst:65 msgid "" -"Return an iterator for the week day numbers that will be used for one week. " +"Return an iterator for the weekday numbers that will be used for one week. " "The first value from the iterator will be the same as the value of the :attr:" "`~Calendar.firstweekday` property." msgstr "" @@ -141,7 +141,7 @@ msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " "Days returned will be tuples consisting of a day of the month number and a " -"week day number." +"weekday number." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由該月當日的數字及代表週" @@ -541,7 +541,7 @@ msgstr "回傳包含一週每一天的名稱縮寫的標題。*n* 指定每一 #: ../../library/calendar.rst:408 msgid "" -"Returns weekday of first day of the month and number of days in month, for " +"Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "回傳指定 *year* 年 *month* 月該月第一天代表週幾的數字及該月有多少天。" @@ -584,7 +584,7 @@ msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " "corresponding Unix timestamp value, assuming an epoch of 1970, and the POSIX " -"encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each others' " +"encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each other's " "inverse." msgstr "" "一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡的 :func:`~time." @@ -661,56 +661,63 @@ msgid "The :mod:`!calendar` module defines the following exceptions:" msgstr ":mod:`!calendar` 模組定義了以下例外:" #: ../../library/calendar.rst:547 +#, fuzzy msgid "" -"A subclass of :exc:`ValueError`, raised when the given month number is " -"outside of the range 1-12 (inclusive)." +"A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given " +"month number is outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:552 +#: ../../library/calendar.rst:550 +msgid "" +":exc:`IllegalMonthError` is now also a subclass of :exc:`ValueError`. New " +"code should avoid catching :exc:`IndexError`." +msgstr "" + +#: ../../library/calendar.rst:557 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:557 +#: ../../library/calendar.rst:562 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:562 +#: ../../library/calendar.rst:567 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:567 +#: ../../library/calendar.rst:572 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:568 +#: ../../library/calendar.rst:573 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:571 +#: ../../library/calendar.rst:576 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:572 +#: ../../library/calendar.rst:577 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:578 +#: ../../library/calendar.rst:583 msgid "Command-line usage" msgstr "命令列用法" -#: ../../library/calendar.rst:582 +#: ../../library/calendar.rst:587 msgid "" "The :mod:`!calendar` module can be executed as a script from the command " "line to interactively print a calendar." msgstr ":mod:`!calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:585 +#: ../../library/calendar.rst:590 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -720,11 +727,11 @@ msgstr "" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:592 +#: ../../library/calendar.rst:597 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:594 +#: ../../library/calendar.rst:599 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -802,40 +809,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:635 +#: ../../library/calendar.rst:640 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:642 +#: ../../library/calendar.rst:647 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:647 +#: ../../library/calendar.rst:652 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:653 +#: ../../library/calendar.rst:658 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:659 +#: ../../library/calendar.rst:664 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:665 +#: ../../library/calendar.rst:670 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:673 +#: ../../library/calendar.rst:678 msgid "The year to print the calendar for. Defaults to the current year." msgstr "印出日曆的年份。預設為目前年份。" -#: ../../library/calendar.rst:679 +#: ../../library/calendar.rst:684 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -844,11 +851,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:685 +#: ../../library/calendar.rst:690 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:689 +#: ../../library/calendar.rst:694 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -856,7 +863,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:697 +#: ../../library/calendar.rst:702 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -864,27 +871,27 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:705 +#: ../../library/calendar.rst:710 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:712 +#: ../../library/calendar.rst:717 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:715 +#: ../../library/calendar.rst:720 msgid "" "By default, today's date is highlighted in color and can be :ref:`controlled " "using environment variables `." msgstr "" -#: ../../library/calendar.rst:719 +#: ../../library/calendar.rst:724 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:723 +#: ../../library/calendar.rst:728 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/gc.po b/library/gc.po index 324a3086d7..796b0d55d9 100644 --- a/library/gc.po +++ b/library/gc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-07 00:19+0000\n" +"POT-Creation-Date: 2026-04-27 00:28+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,11 +63,12 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 +#, fuzzy msgid "" -"Perform a collection. The optional argument *generation* may be an integer " -"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " -"is raised if the generation number is invalid. The sum of collected objects " -"and uncollectable objects is returned." +"With no arguments, run a full collection. The optional argument " +"*generation* may be an integer specifying which generation to collect (from " +"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " +"The sum of collected objects and uncollectable objects is returned." msgstr "" "啟動垃圾回收。可選的引數 *generation* 可以是一個指明需要回收哪一代垃圾的整數" "(從 0 到 2)。當 generation 數值無效時,會引發 :exc:`ValueError` 例外。可回" @@ -75,23 +76,6 @@ msgstr "" #: ../../library/gc.rst:48 msgid "" -"Calling ``gc.collect(0)`` will perform a GC collection on the young " -"generation." -msgstr "呼叫 ``gc.collect(0)`` 將對年輕代執行 GC 回收。" - -#: ../../library/gc.rst:50 -msgid "" -"Calling ``gc.collect(1)`` will perform a GC collection on the young " -"generation and an increment of the old generation." -msgstr "呼叫 ``gc.collect(1)`` 將對年輕代執行 GC 回收並對年老代執行增量回收。" - -#: ../../library/gc.rst:53 -msgid "" -"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" -msgstr "呼叫 ``gc.collect(2)`` 或 ``gc.collect()`` 執行完整回收" - -#: ../../library/gc.rst:55 -msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " "run. Not all items in some free lists may be freed due to the particular " @@ -101,17 +85,22 @@ msgstr "" "為了特定型別的實現,特別是 :class:`float`,在某些空閒列表中並非所有項目都會被" "釋放。" -#: ../../library/gc.rst:60 +#: ../../library/gc.rst:53 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" -#: ../../library/gc.rst:63 +#: ../../library/gc.rst:56 msgid "``generation=1`` performs an increment of collection." msgstr "``generation=1`` 會執行增量收集。" -#: ../../library/gc.rst:69 +#: ../../library/gc.rst:59 +#, fuzzy +msgid "``generation=1`` performs collection of the middle generation." +msgstr "``generation=1`` 會執行增量收集。" + +#: ../../library/gc.rst:65 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " @@ -120,40 +109,33 @@ msgstr "" "設定垃圾回收器的除錯旗標。除錯資訊會被寫入 ``sys.stderr``。請見下方的除錯旗標" "列表,可以使用位元操作 (bit operation) 進行設定以控制除錯程式。" -#: ../../library/gc.rst:76 +#: ../../library/gc.rst:72 msgid "Return the debugging flags currently set." msgstr "回傳目前設置的除錯旗標。" -#: ../../library/gc.rst:82 +#: ../../library/gc.rst:77 +#, fuzzy msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not ``None``, return only the objects as " -"follows:" +"returned. If *generation* is not ``None``, return only the objects tracked " +"by the collector that are in that generation." msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " "*generation* 不為 ``None``,只回傳以下物件。" -#: ../../library/gc.rst:85 -msgid "0: All objects in the young generation" -msgstr "0: 年輕代中的所有物件。" - -#: ../../library/gc.rst:86 -msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" -msgstr "1: 沒有物件,因為不存在第一代(截至 Python 3.14)" - -#: ../../library/gc.rst:87 -msgid "2: All objects in the old generation" -msgstr "2: 年老代中的所有物件。" - -#: ../../library/gc.rst:89 +#: ../../library/gc.rst:81 msgid "New *generation* parameter." msgstr "新增 *generation* 參數。" -#: ../../library/gc.rst:92 +#: ../../library/gc.rst:84 msgid "Generation 1 is removed" msgstr "第一代已被刪除" -#: ../../library/gc.rst:95 +#: ../../library/gc.rst:87 +msgid "Generation 1 is reintroduced to maintain GC behavior from 3.13." +msgstr "" + +#: ../../library/gc.rst:90 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." @@ -161,7 +143,7 @@ msgstr "" "引發一個附帶引數 ``generation`` 的\\ :ref:`稽核事件 (auditing event) " "` ``gc.get_objects``。" -#: ../../library/gc.rst:99 +#: ../../library/gc.rst:94 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " @@ -171,17 +153,17 @@ msgstr "" "的垃圾回收統計資料。字典的鍵的數目在將來可能會改變,但目前每個字典包含以下項" "目:" -#: ../../library/gc.rst:104 +#: ../../library/gc.rst:99 msgid "``collections`` is the number of times this generation was collected;" msgstr "``collections`` 是該代被回收的次數;" -#: ../../library/gc.rst:106 +#: ../../library/gc.rst:101 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "``collected`` 是該代中被回收的物件總數;" -#: ../../library/gc.rst:109 +#: ../../library/gc.rst:104 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " @@ -190,34 +172,43 @@ msgstr "" "``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" "`garbage` list 中)。" -#: ../../library/gc.rst:118 +#: ../../library/gc.rst:113 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。" -#: ../../library/gc.rst:121 -msgid "" -"The GC classifies objects into two generations depending on whether they " -"have survived a collection. New objects are placed in the young generation. " -"If an object survives a collection it is moved into the old generation." -msgstr "" -"GC 根據物件是否在回收中倖存下來而將其分為兩代。新的物件會被放置在年輕代中。如" -"果一個物件在回收中倖存下來,它將被移動到年老代中。" - -#: ../../library/gc.rst:125 -msgid "" -"In order to decide when to run, the collector keeps track of the number of " -"object allocations and deallocations since the last collection. When the " -"number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. For each collection, all the objects in the " -"young generation and some fraction of the old generation is collected." -msgstr "" -"為了決定何時運行,回收器會追蹤自上次回收以來物件分配和釋放的數量。當分配數量" -"減去釋放數量超過 *threshold0* 時,回收就會開始。每次回收都會去回收年輕代中的" -"所有物件和年老代的部分物件。" - -#: ../../library/gc.rst:131 +#: ../../library/gc.rst:116 +#, fuzzy +msgid "" +"The GC classifies objects into three generations depending on how many " +"collection sweeps they have survived. New objects are placed in the " +"youngest generation (generation ``0``). If an object survives a collection " +"it is moved into the next older generation. Since generation ``2`` is the " +"oldest generation, objects in that generation remain there after a " +"collection. In order to decide when to run, the collector keeps track of " +"the number object allocations and deallocations since the last collection. " +"When the number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. Initially only generation ``0`` is " +"examined. If generation ``0`` has been examined more than *threshold1* " +"times since generation ``1`` has been examined, then generation ``1`` is " +"examined as well. With the third generation, things are a bit more " +"complicated, see `Collecting the oldest generation `_ for more " +"information." +msgstr "" +"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件" +"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移" +"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留" +"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數" +"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始" +"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 " +"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一" +"些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" + +#: ../../library/gc.rst:130 msgid "" "In the free-threaded build, the increase in process memory usage is also " "checked before running the collector. If the memory usage has not increased " @@ -228,21 +219,7 @@ msgstr "" "使用量的增加。如果自上次回收以來記憶體使用量未增加 10%,且物件分配的淨數量未" "超過 *threshold0* 的 40 倍,則不會運行回收。" -#: ../../library/gc.rst:136 -msgid "" -"The fraction of the old generation that is collected is **inversely** " -"proportional to *threshold1*. The larger *threshold1* is, the slower objects " -"in the old generation are collected. For the default value of 10, 1% of the " -"old generation is scanned during each collection." -msgstr "" -"年老代中被回收的物件比例與 *threshold1* 成\\ **反比**。*threshold1* 越大,年" -"老代中物件的回收就越慢。以預設值 10 來說,每次回收時會掃描年老代中的 1%。" - -#: ../../library/gc.rst:141 -msgid "*threshold2* is ignored." -msgstr "*threshold2* 會被忽略。" - -#: ../../library/gc.rst:143 +#: ../../library/gc.rst:135 msgid "" "See `Garbage collector design `_ for more information." @@ -250,24 +227,28 @@ msgstr "" "有關更多資訊,請參閱\\ `垃圾回收器設計 `_。" -#: ../../library/gc.rst:145 +#: ../../library/gc.rst:137 msgid "*threshold2* is ignored" msgstr "*threshold2* 會被忽略" -#: ../../library/gc.rst:151 +#: ../../library/gc.rst:140 +msgid "*threshold2* is restored to match Python 3.13 behavior." +msgstr "" + +#: ../../library/gc.rst:146 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "將目前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:157 +#: ../../library/gc.rst:152 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" "將目前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:163 +#: ../../library/gc.rst:158 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -277,7 +258,7 @@ msgstr "" "回傳包含直接參照 objs 中任一個物件的物件 list。這個函式只定位支援垃圾回收的容" "器;參照了其它物件但不支援垃圾回收的擴充套件型別無法被找到。" -#: ../../library/gc.rst:168 +#: ../../library/gc.rst:163 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -288,7 +269,7 @@ msgstr "" "會被作為參照者出現在回傳的 list 中。若只要取得目前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" -#: ../../library/gc.rst:174 +#: ../../library/gc.rst:169 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -299,7 +280,7 @@ msgstr "" "在建構中而處於暫時無效的狀態。不要把 :func:`get_referrers` 用於除錯以外的其它" "目的。" -#: ../../library/gc.rst:179 +#: ../../library/gc.rst:174 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." @@ -307,7 +288,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referrers``。" -#: ../../library/gc.rst:184 +#: ../../library/gc.rst:179 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -325,7 +306,7 @@ msgstr "" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" -#: ../../library/gc.rst:192 +#: ../../library/gc.rst:187 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." @@ -333,7 +314,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referents``。" -#: ../../library/gc.rst:196 +#: ../../library/gc.rst:191 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -347,7 +328,7 @@ msgstr "" "件)會被追蹤。然而,有一些特定型別最佳化會被用來減少垃圾回收器在簡單實例(如" "只含有原子性的鍵和值的字典)上的足跡: ::" -#: ../../library/gc.rst:203 +#: ../../library/gc.rst:198 msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -371,14 +352,14 @@ msgstr "" ">>> gc.is_tracked({\"a\": 1})\n" "True" -#: ../../library/gc.rst:219 +#: ../../library/gc.rst:214 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" "如果給定物件已被垃圾回收器終結則回傳 ``True``,否則回傳 ``False``。: ::" -#: ../../library/gc.rst:222 +#: ../../library/gc.rst:217 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -406,7 +387,7 @@ msgstr "" ">>> gc.is_finalized(x)\n" "True" -#: ../../library/gc.rst:240 +#: ../../library/gc.rst:235 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." @@ -414,7 +395,7 @@ msgstr "" "凍結 (freeze) 垃圾回收器所追蹤的所有物件;將它們移至永久代並忽略所有未來的收" "集動作。" -#: ../../library/gc.rst:243 +#: ../../library/gc.rst:238 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -432,23 +413,23 @@ msgstr "" "disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " "``gc.enable()``。" -#: ../../library/gc.rst:257 +#: ../../library/gc.rst:252 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "解凍 (unfreeze) 永久代中的物件,並將它們放回到最年老代中。" -#: ../../library/gc.rst:265 +#: ../../library/gc.rst:260 msgid "Return the number of objects in the permanent generation." msgstr "回傳永久代中的物件數量。" -#: ../../library/gc.rst:270 +#: ../../library/gc.rst:265 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "以下變數僅供唯讀存取(你可以修改其值但不應該重新繫結 (rebind) 它們):" -#: ../../library/gc.rst:275 +#: ../../library/gc.rst:270 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -459,7 +440,7 @@ msgstr "" "開始,該 list 在大多數時候都應該是空的,除非使用了有非 ``NULL`` ``tp_del`` 槽" "位的 C 擴充套件型別的實例。" -#: ../../library/gc.rst:280 +#: ../../library/gc.rst:275 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." @@ -467,7 +448,7 @@ msgstr "" "如果設定了 :const:`DEBUG_SAVEALL`,則所有不可達物件將被加進該 list 而不會被釋" "放。" -#: ../../library/gc.rst:283 +#: ../../library/gc.rst:278 msgid "" "If this list is non-empty at :term:`interpreter shutdown`, a :exc:" "`ResourceWarning` is emitted, which is silent by default. If :const:" @@ -478,7 +459,7 @@ msgstr "" "`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" "`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" -#: ../../library/gc.rst:289 +#: ../../library/gc.rst:284 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." @@ -486,7 +467,7 @@ msgstr "" "根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" "`gc.garbage` 內。" -#: ../../library/gc.rst:295 +#: ../../library/gc.rst:290 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " @@ -495,29 +476,29 @@ msgstr "" "會被垃圾回收器在回收開始前和完成後叫用的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" -#: ../../library/gc.rst:299 +#: ../../library/gc.rst:294 msgid "*phase* can be one of two values:" msgstr "*phase* 可為以下兩者之一:" -#: ../../library/gc.rst:301 +#: ../../library/gc.rst:296 msgid "\"start\": The garbage collection is about to start." msgstr "\"start\":垃圾回收即將開始。" -#: ../../library/gc.rst:303 +#: ../../library/gc.rst:298 msgid "\"stop\": The garbage collection has finished." msgstr "\"stop\":垃圾回收已結束。" -#: ../../library/gc.rst:305 +#: ../../library/gc.rst:300 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "*info* 是一個字典,提供回呼函式更多資訊。已有定義的鍵有:" -#: ../../library/gc.rst:308 +#: ../../library/gc.rst:303 msgid "\"generation\": The oldest generation being collected." msgstr "\"generation\"(代):正在被回收的最年老的一代。" -#: ../../library/gc.rst:310 +#: ../../library/gc.rst:305 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." @@ -525,7 +506,7 @@ msgstr "" "\"collected\"(已回收的):當 *phase* 為 \"stop\" 時,被成功回收的物件的數" "目。" -#: ../../library/gc.rst:313 +#: ../../library/gc.rst:308 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." @@ -533,40 +514,40 @@ msgstr "" "\"uncollectable\"(不可回收的):當 *phase* 為 \"stop\" 時,不能被回收並被放" "入 :data:`garbage` 的物件的數目。" -#: ../../library/gc.rst:316 +#: ../../library/gc.rst:311 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "應用程式可以把他們自己的回呼函式加入此 list。主要的使用場景有:" -#: ../../library/gc.rst:319 +#: ../../library/gc.rst:314 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "收集垃圾回收的統計資料,如:不同代的回收頻率、回收任務所花費的時間。" -#: ../../library/gc.rst:323 +#: ../../library/gc.rst:318 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" "讓應用程式可以識別和清理他們自己在 :data:`garbage` 中的不可回收型別物件。" -#: ../../library/gc.rst:329 +#: ../../library/gc.rst:324 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "以下常數是為了和 :func:`set_debug` 一起使用所提供:" -#: ../../library/gc.rst:334 +#: ../../library/gc.rst:329 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "在回收完成後印出統計資訊。當調校回收頻率設定時,這些資訊會很有用。" -#: ../../library/gc.rst:340 +#: ../../library/gc.rst:335 msgid "Print information on collectable objects found." msgstr "當發現可回收物件時印出資訊。" -#: ../../library/gc.rst:345 +#: ../../library/gc.rst:340 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " @@ -575,7 +556,7 @@ msgstr "" "印出找到的不可回收物件的資訊(指不能被回收器回收的不可達物件)。這些物件會被" "新增到 ``garbage`` list 中。" -#: ../../library/gc.rst:349 +#: ../../library/gc.rst:344 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." @@ -583,7 +564,7 @@ msgstr "" "當 :term:`interpreter shutdown`\\ (直譯器關閉)時,若 :data:`garbage` list " "不是空的,那這些內容也會被印出。" -#: ../../library/gc.rst:355 +#: ../../library/gc.rst:350 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." @@ -591,7 +572,7 @@ msgstr "" "設定後,所有回收器找到的不可達物件會被加進 *garbage* 而不是直接被釋放。這在為" "一個記憶體流失的程式除錯時會很有用。" -#: ../../library/gc.rst:361 +#: ../../library/gc.rst:356 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " @@ -601,29 +582,58 @@ msgstr "" "``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)。" #~ msgid "" -#~ "The GC classifies objects into three generations depending on how many " -#~ "collection sweeps they have survived. New objects are placed in the " -#~ "youngest generation (generation ``0``). If an object survives a " -#~ "collection it is moved into the next older generation. Since generation " -#~ "``2`` is the oldest generation, objects in that generation remain there " -#~ "after a collection. In order to decide when to run, the collector keeps " -#~ "track of the number object allocations and deallocations since the last " -#~ "collection. When the number of allocations minus the number of " -#~ "deallocations exceeds *threshold0*, collection starts. Initially only " -#~ "generation ``0`` is examined. If generation ``0`` has been examined more " -#~ "than *threshold1* times since generation ``1`` has been examined, then " -#~ "generation ``1`` is examined as well. With the third generation, things " -#~ "are a bit more complicated, see `Collecting the oldest generation " -#~ "`_ for more information." +#~ "Calling ``gc.collect(0)`` will perform a GC collection on the young " +#~ "generation." +#~ msgstr "呼叫 ``gc.collect(0)`` 將對年輕代執行 GC 回收。" + +#~ msgid "" +#~ "Calling ``gc.collect(1)`` will perform a GC collection on the young " +#~ "generation and an increment of the old generation." +#~ msgstr "" +#~ "呼叫 ``gc.collect(1)`` 將對年輕代執行 GC 回收並對年老代執行增量回收。" + +#~ msgid "" +#~ "Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" +#~ msgstr "呼叫 ``gc.collect(2)`` 或 ``gc.collect()`` 執行完整回收" + +#~ msgid "0: All objects in the young generation" +#~ msgstr "0: 年輕代中的所有物件。" + +#~ msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" +#~ msgstr "1: 沒有物件,因為不存在第一代(截至 Python 3.14)" + +#~ msgid "2: All objects in the old generation" +#~ msgstr "2: 年老代中的所有物件。" + +#~ msgid "" +#~ "The GC classifies objects into two generations depending on whether they " +#~ "have survived a collection. New objects are placed in the young " +#~ "generation. If an object survives a collection it is moved into the old " +#~ "generation." +#~ msgstr "" +#~ "GC 根據物件是否在回收中倖存下來而將其分為兩代。新的物件會被放置在年輕代" +#~ "中。如果一個物件在回收中倖存下來,它將被移動到年老代中。" + +#~ msgid "" +#~ "In order to decide when to run, the collector keeps track of the number " +#~ "of object allocations and deallocations since the last collection. When " +#~ "the number of allocations minus the number of deallocations exceeds " +#~ "*threshold0*, collection starts. For each collection, all the objects in " +#~ "the young generation and some fraction of the old generation is collected." #~ msgstr "" -#~ "垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物" -#~ "件會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會" -#~ "被移入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後" -#~ "仍會保留原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和" -#~ "釋放的數量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會" -#~ "開始。初始時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代" -#~ "已被檢查超過 *threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情" -#~ "況還會更復雜一些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" +#~ "為了決定何時運行,回收器會追蹤自上次回收以來物件分配和釋放的數量。當分配數" +#~ "量減去釋放數量超過 *threshold0* 時,回收就會開始。每次回收都會去回收年輕代" +#~ "中的所有物件和年老代的部分物件。" + +#~ msgid "" +#~ "The fraction of the old generation that is collected is **inversely** " +#~ "proportional to *threshold1*. The larger *threshold1* is, the slower " +#~ "objects in the old generation are collected. For the default value of 10, " +#~ "1% of the old generation is scanned during each collection." +#~ msgstr "" +#~ "年老代中被回收的物件比例與 *threshold1* 成\\ **反比**。*threshold1* 越大," +#~ "年老代中物件的回收就越慢。以預設值 10 來說,每次回收時會掃描年老代中的 " +#~ "1%。" + +#~ msgid "*threshold2* is ignored." +#~ msgstr "*threshold2* 會被忽略。" diff --git a/library/html.parser.po b/library/html.parser.po index 12dbed58a9..f379b9af46 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-01 00:16+0000\n" +"POT-Creation-Date: 2026-04-28 00:31+0000\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,8 +46,8 @@ msgid "" "(except the ones in elements like ``script`` and ``style``) are " "automatically converted to the corresponding Unicode characters." msgstr "" -"如果 *convert_charrefs* 為 true (預設值),所有字元參照 (reference)" -"(元素中的參照除外,像是 ``script`` 和 ``style`` )將自動轉換為相應的 Unicode 字元。" +"如果 *convert_charrefs* 為 true (預設值),所有字元參照 (reference)(元素中" +"的參照除外,像是 ``script`` 和 ``style`` )將自動轉換為相應的 Unicode 字元。" #: ../../library/html.parser.rst:26 msgid "" @@ -55,8 +55,8 @@ msgid "" "element is parsed normally; if it's true, it's returned as is without being " "parsed." msgstr "" -"如果 *scripting* 為 false(預設值),``noscript`` 元素的內容會被正常" -"剖析;如果為 true,則會原樣回傳而不進行剖析。" +"如果 *scripting* 為 false(預設值),``noscript`` 元素的內容會被正常剖析;如" +"果為 true,則會原樣回傳而不進行剖析。" #: ../../library/html.parser.rst:30 msgid "" @@ -235,12 +235,14 @@ msgid "" msgstr "呼叫此方法來處理元素的開始標籤(例如 ``
``)。" #: ../../library/html.parser.rst:140 +#, fuzzy msgid "" "The *tag* argument is the name of the tag converted to lower case. The " "*attrs* argument is a list of ``(name, value)`` pairs containing the " "attributes found inside the tag's ``<>`` brackets. The *name* will be " "translated to lower case, and quotes in the *value* have been removed, and " -"character and entity references have been replaced." +"character and entity references have been replaced. For empty attributes, " +"*value* is ``None``." msgstr "" "*tag* 引數是轉換為小寫的標籤名稱。 *attrs* 引數是一個 ``(name, value)`` 對的" "列表,包含在標籤的 ``<>`` 括號內找到的屬性。 *name* 將被轉成小寫,*value* 中" @@ -288,7 +290,8 @@ msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " "content of elements like ``script`` and ``style``)." msgstr "" -"呼叫此方法來處理任意資料(例如文本節點與像是 ``script`` 和 ``style`` 元素的內容)。" +"呼叫此方法來處理任意資料(例如文本節點與像是 ``script`` 和 ``style`` 元素的內" +"容)。" #: ../../library/html.parser.rst:176 msgid "" @@ -310,8 +313,8 @@ msgid "" msgstr "" "呼叫此方法來處理 :samp:`&#{NNN};` 和 :samp:`&#x{NNN};` 形式的十進位和十六進位" "數字字元參照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 ``>" -"``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。此方法只有在 *convert_charrefs* 為 " -"false 時才會被呼叫。" +"``;在這種情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。此方法只有在 " +"*convert_charrefs* 為 false 時才會被呼叫。" #: ../../library/html.parser.rst:193 msgid "" @@ -516,7 +519,8 @@ msgstr "" msgid "" "The content of elements like ``script`` and ``style`` is returned as is, " "without further parsing:" -msgstr "像是 ``script`` 和 ``style`` 這類元素的內容將按原樣回傳,無需進一步的剖析:" +msgstr "" +"像是 ``script`` 和 ``style`` 這類元素的內容將按原樣回傳,無需進一步的剖析:" #: ../../library/html.parser.rst:305 msgid "" @@ -549,10 +553,28 @@ msgstr "" "End tag : script" #: ../../library/html.parser.rst:320 +msgid "" +"Attribute names are converted to lowercase, quotes from attribute values " +"removed, and ``None`` is returned as *value* for empty attributes (such as " +"``checked``):" +msgstr "" + +#: ../../library/html.parser.rst:323 +msgid "" +">>> parser.feed(\"\")\n" +"Start tag: input\n" +" attr: ('type', 'checkbox')\n" +" attr: ('checked', None)\n" +" attr: ('required', '')\n" +" attr: ('disabled', 'disabled')" +msgstr "" + +#: ../../library/html.parser.rst:332 msgid "Parsing comments:" msgstr "剖析註解:" -#: ../../library/html.parser.rst:322 +#: ../../library/html.parser.rst:334 msgid "" ">>> parser.feed(''\n" "... '')\n" @@ -564,7 +586,7 @@ msgstr "" "Comment : a comment\n" "Comment : [if IE 9]>IE-specific content'``):" @@ -572,7 +594,7 @@ msgstr "" "剖析附名 (named) 且為數值的 (numeric) 字元參照,並將它們轉換為正確的字元(注" "意:這 3 個參照都等同於 ``'>'``):" -#: ../../library/html.parser.rst:332 +#: ../../library/html.parser.rst:344 msgid "" ">>> parser = MyHTMLParser()\n" ">>> parser.feed('>>>')\n" @@ -594,16 +616,17 @@ msgstr "" "Num ent : >\n" "Num ent : >" -#: ../../library/html.parser.rst:344 +#: ../../library/html.parser.rst:356 msgid "" "Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but :meth:" "`~HTMLParser.handle_data` might be called more than once if " "*convert_charrefs* is false:" msgstr "" -"將不完整的區塊提供給 :meth:`~HTMLParser.feed` 是可行的,但是如果 *convert_charrefs* 為 false," -":meth:`~HTMLParser.handle_data` 可能會被呼叫多次:" +"將不完整的區塊提供給 :meth:`~HTMLParser.feed` 是可行的,但是如果 " +"*convert_charrefs* 為 false,:meth:`~HTMLParser.handle_data` 可能會被呼叫多" +"次:" -#: ../../library/html.parser.rst:348 +#: ../../library/html.parser.rst:360 msgid "" ">>> for chunk in ['buff', 'ered', ' text']:\n" "... parser.feed(chunk)\n" @@ -623,11 +646,11 @@ msgstr "" "Data : text\n" "End tag : span" -#: ../../library/html.parser.rst:359 +#: ../../library/html.parser.rst:371 msgid "Parsing invalid HTML (e.g. unquoted attributes) also works:" msgstr "也能夠剖析無效的 HTML(例如未加引號的屬性):" -#: ../../library/html.parser.rst:361 +#: ../../library/html.parser.rst:373 msgid "" ">>> parser.feed('

tag soup

')\n" "Start tag: p\n" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 343df65b1c..7c90e8b58a 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-05-01 00:34+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,60 +35,59 @@ msgid "" "glossary/#term-Distribution-Package>`_, such as its entry points or its top-" "level names (`Import Package `_\\s, modules, if any). Built in part on " -"Python's import system, this library intends to replace similar " -"functionality in the `entry point API`_ and `metadata API`_ of " -"``pkg_resources``. Along with :mod:`importlib.resources`, this package can " -"eliminate the need to use the older and less efficient ``pkg_resources`` " -"package." +"Python's import system, this library provides the entry point and metadata " +"APIs that were previously exposed by the now-removed ``pkg_resources`` " +"package. Along with :mod:`importlib.resources`, it supersedes " +"``pkg_resources``." msgstr "" -#: ../../library/importlib.metadata.rst:27 +#: ../../library/importlib.metadata.rst:25 msgid "" "``importlib.metadata`` operates on third-party *distribution packages* " -"installed into Python's ``site-packages`` directory via tools such " -"as :pypi:`pip`. Specifically, it works with distributions with discoverable " -"``dist-info`` or ``egg-info`` directories, and metadata defined by the `Core " +"installed into Python's ``site-packages`` directory via tools such as :pypi:" +"`pip`. Specifically, it works with distributions with discoverable ``dist-" +"info`` or ``egg-info`` directories, and metadata defined by the `Core " "metadata specifications `_." msgstr "" -#: ../../library/importlib.metadata.rst:36 +#: ../../library/importlib.metadata.rst:34 msgid "" "These are *not* necessarily equivalent to or correspond 1:1 with the top-" "level *import package* names that can be imported inside Python code. One " "*distribution package* can contain multiple *import packages* (and single " "modules), and one top-level *import package* may map to multiple " -"*distribution packages* if it is a namespace package. You can " -"use :ref:`packages_distributions() ` to get a mapping " -"between them." +"*distribution packages* if it is a namespace package. You can use :ref:" +"`packages_distributions() ` to get a mapping between " +"them." msgstr "" -#: ../../library/importlib.metadata.rst:47 +#: ../../library/importlib.metadata.rst:45 msgid "" "By default, distribution metadata can live on the file system or in zip " "archives on :data:`sys.path`. Through an extension mechanism, the metadata " "can live almost anywhere." msgstr "" -#: ../../library/importlib.metadata.rst:55 +#: ../../library/importlib.metadata.rst:53 msgid "https://importlib-metadata.readthedocs.io/" msgstr "https://importlib-metadata.readthedocs.io/" -#: ../../library/importlib.metadata.rst:56 +#: ../../library/importlib.metadata.rst:54 msgid "" "The documentation for ``importlib_metadata``, which supplies a backport of " "``importlib.metadata``. This includes an `API reference `__ for this module's classes and " -"functions, as well as a `migration guide `__ for existing users of " +"functions, as well as a `migration guide `__ for existing users of " "``pkg_resources``." msgstr "" -#: ../../library/importlib.metadata.rst:67 +#: ../../library/importlib.metadata.rst:65 msgid "Overview" msgstr "" -#: ../../library/importlib.metadata.rst:69 +#: ../../library/importlib.metadata.rst:67 msgid "" "Let's say you wanted to get the version string for a `Distribution Package " ">> from importlib.metadata import version\n" @@ -122,19 +121,19 @@ msgstr "" ">>> version('wheel')\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:89 +#: ../../library/importlib.metadata.rst:87 msgid "" "You can also get a collection of entry points selectable by properties of " "the EntryPoint (typically 'group' or 'name'), such as ``console_scripts``, " -"``distutils.commands`` and others. Each group contains a collection " -"of :ref:`EntryPoint ` objects." +"``distutils.commands`` and others. Each group contains a collection of :ref:" +"`EntryPoint ` objects." msgstr "" -#: ../../library/importlib.metadata.rst:93 +#: ../../library/importlib.metadata.rst:91 msgid "You can get the :ref:`metadata for a distribution `::" msgstr "" -#: ../../library/importlib.metadata.rst:95 +#: ../../library/importlib.metadata.rst:93 msgid "" ">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " @@ -154,33 +153,33 @@ msgstr "" "'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', " "'Requires-Dist']" -#: ../../library/importlib.metadata.rst:98 +#: ../../library/importlib.metadata.rst:96 msgid "" -"You can also get a :ref:`distribution's version number `, list " -"its :ref:`constituent files `, and get a list of the " -"distribution's :ref:`requirements`." +"You can also get a :ref:`distribution's version number `, list its :" +"ref:`constituent files `, and get a list of the distribution's :ref:" +"`requirements`." msgstr "" -#: ../../library/importlib.metadata.rst:105 +#: ../../library/importlib.metadata.rst:103 msgid "" "Subclass of :class:`ModuleNotFoundError` raised by several functions in this " "module when queried for a distribution package which is not installed in the " "current Python environment." msgstr "" -#: ../../library/importlib.metadata.rst:111 +#: ../../library/importlib.metadata.rst:109 msgid "Functional API" msgstr "" -#: ../../library/importlib.metadata.rst:113 +#: ../../library/importlib.metadata.rst:111 msgid "This package provides the following functionality via its public API." msgstr "" -#: ../../library/importlib.metadata.rst:119 +#: ../../library/importlib.metadata.rst:117 msgid "Entry points" msgstr "" -#: ../../library/importlib.metadata.rst:123 +#: ../../library/importlib.metadata.rst:121 msgid "" "Returns a :class:`EntryPoints` instance describing entry points for the " "current environment. Any given keyword parameters are passed to the :meth:`!" @@ -188,54 +187,54 @@ msgid "" "point definitions." msgstr "" -#: ../../library/importlib.metadata.rst:128 +#: ../../library/importlib.metadata.rst:126 msgid "" -"Note: it is not currently possible to query for entry points based on " -"their :attr:`!EntryPoint.dist` attribute (as different :class:`!" -"Distribution` instances do not currently compare equal, even if they have " -"the same attributes)" +"Note: it is not currently possible to query for entry points based on their :" +"attr:`!EntryPoint.dist` attribute (as different :class:`!Distribution` " +"instances do not currently compare equal, even if they have the same " +"attributes)" msgstr "" -#: ../../library/importlib.metadata.rst:134 +#: ../../library/importlib.metadata.rst:132 msgid "Details of a collection of installed entry points." msgstr "" -#: ../../library/importlib.metadata.rst:136 +#: ../../library/importlib.metadata.rst:134 msgid "" "Also provides a ``.groups`` attribute that reports all identified entry " "point groups, and a ``.names`` attribute that reports all identified entry " "point names." msgstr "" -#: ../../library/importlib.metadata.rst:142 +#: ../../library/importlib.metadata.rst:140 msgid "Details of an installed entry point." msgstr "" -#: ../../library/importlib.metadata.rst:144 +#: ../../library/importlib.metadata.rst:142 msgid "" "Each :class:`!EntryPoint` instance has ``.name``, ``.group``, and ``.value`` " -"attributes and a ``.load()`` method to resolve the value. There are also " -"``.module``, ``.attr``, and ``.extras`` attributes for getting the " -"components of the ``.value`` attribute, and ``.dist`` for obtaining " -"information regarding the distribution package that provides the entry point." +"attributes and a ``.load()`` method to resolve the value. There are also ``." +"module``, ``.attr``, and ``.extras`` attributes for getting the components " +"of the ``.value`` attribute, and ``.dist`` for obtaining information " +"regarding the distribution package that provides the entry point." msgstr "" -#: ../../library/importlib.metadata.rst:150 +#: ../../library/importlib.metadata.rst:148 msgid "Query all entry points::" msgstr "" -#: ../../library/importlib.metadata.rst:152 +#: ../../library/importlib.metadata.rst:150 msgid ">>> eps = entry_points()" msgstr ">>> eps = entry_points()" -#: ../../library/importlib.metadata.rst:154 +#: ../../library/importlib.metadata.rst:152 msgid "" "The :func:`!entry_points` function returns a :class:`!EntryPoints` object, a " "collection of all :class:`!EntryPoint` objects with ``names`` and ``groups`` " "attributes for convenience::" msgstr "" -#: ../../library/importlib.metadata.rst:158 +#: ../../library/importlib.metadata.rst:156 msgid "" ">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " @@ -245,33 +244,33 @@ msgstr "" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" -#: ../../library/importlib.metadata.rst:161 +#: ../../library/importlib.metadata.rst:159 msgid "" ":class:`!EntryPoints` has a :meth:`!select` method to select entry points " "matching specific properties. Select entry points in the ``console_scripts`` " "group::" msgstr "" -#: ../../library/importlib.metadata.rst:165 +#: ../../library/importlib.metadata.rst:163 msgid ">>> scripts = eps.select(group='console_scripts')" msgstr ">>> scripts = eps.select(group='console_scripts')" -#: ../../library/importlib.metadata.rst:167 +#: ../../library/importlib.metadata.rst:165 msgid "" "Equivalently, since :func:`!entry_points` passes keyword arguments through " "to select::" msgstr "" -#: ../../library/importlib.metadata.rst:170 +#: ../../library/importlib.metadata.rst:168 msgid ">>> scripts = entry_points(group='console_scripts')" msgstr ">>> scripts = entry_points(group='console_scripts')" -#: ../../library/importlib.metadata.rst:172 +#: ../../library/importlib.metadata.rst:170 msgid "" "Pick out a specific script named \"wheel\" (found in the wheel project)::" msgstr "" -#: ../../library/importlib.metadata.rst:174 +#: ../../library/importlib.metadata.rst:172 msgid "" ">>> 'wheel' in scripts.names\n" "True\n" @@ -281,11 +280,11 @@ msgstr "" "True\n" ">>> wheel = scripts['wheel']" -#: ../../library/importlib.metadata.rst:178 +#: ../../library/importlib.metadata.rst:176 msgid "Equivalently, query for that entry point during selection::" msgstr "" -#: ../../library/importlib.metadata.rst:180 +#: ../../library/importlib.metadata.rst:178 msgid "" ">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" ">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" @@ -293,11 +292,11 @@ msgstr "" ">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" ">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" -#: ../../library/importlib.metadata.rst:183 +#: ../../library/importlib.metadata.rst:181 msgid "Inspect the resolved entry point::" msgstr "" -#: ../../library/importlib.metadata.rst:185 +#: ../../library/importlib.metadata.rst:183 msgid "" ">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" @@ -323,7 +322,7 @@ msgstr "" ">>> main\n" "" -#: ../../library/importlib.metadata.rst:197 +#: ../../library/importlib.metadata.rst:195 msgid "" "The ``group`` and ``name`` are arbitrary values defined by the package " "author and usually a client will wish to resolve all entry points for a " @@ -332,73 +331,73 @@ msgid "" "their definition, and usage." msgstr "" -#: ../../library/importlib.metadata.rst:203 +#: ../../library/importlib.metadata.rst:201 msgid "" "The \"selectable\" entry points were introduced in ``importlib_metadata`` " "3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted no " "parameters and always returned a dictionary of entry points, keyed by group. " "With ``importlib_metadata`` 5.0 and Python 3.12, ``entry_points`` always " -"returns an ``EntryPoints`` object. " -"See :pypi:`backports.entry_points_selectable` for compatibility options." +"returns an ``EntryPoints`` object. See :pypi:`backports." +"entry_points_selectable` for compatibility options." msgstr "" -#: ../../library/importlib.metadata.rst:212 +#: ../../library/importlib.metadata.rst:210 msgid "" -"``EntryPoint`` objects no longer present a tuple-like interface " -"(:meth:`~object.__getitem__`)." +"``EntryPoint`` objects no longer present a tuple-like interface (:meth:" +"`~object.__getitem__`)." msgstr "" -#: ../../library/importlib.metadata.rst:219 +#: ../../library/importlib.metadata.rst:217 msgid "Distribution metadata" msgstr "" -#: ../../library/importlib.metadata.rst:223 +#: ../../library/importlib.metadata.rst:221 msgid "" "Return the distribution metadata corresponding to the named distribution " "package as a :class:`PackageMetadata` instance." msgstr "" -#: ../../library/importlib.metadata.rst:226 -#: ../../library/importlib.metadata.rst:275 -#: ../../library/importlib.metadata.rst:296 -#: ../../library/importlib.metadata.rst:359 -#: ../../library/importlib.metadata.rst:410 +#: ../../library/importlib.metadata.rst:224 +#: ../../library/importlib.metadata.rst:273 +#: ../../library/importlib.metadata.rst:294 +#: ../../library/importlib.metadata.rst:357 +#: ../../library/importlib.metadata.rst:408 msgid "" "Raises :exc:`PackageNotFoundError` if the named distribution package is not " "installed in the current Python environment." msgstr "" -#: ../../library/importlib.metadata.rst:231 +#: ../../library/importlib.metadata.rst:229 msgid "" "A concrete implementation of the `PackageMetadata protocol `_." +"importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata." +"PackageMetadata>`_." msgstr "" -#: ../../library/importlib.metadata.rst:234 +#: ../../library/importlib.metadata.rst:232 msgid "" "In addition to providing the defined protocol methods and attributes, " "subscripting the instance is equivalent to calling the :meth:`!get` method." msgstr "" -#: ../../library/importlib.metadata.rst:237 +#: ../../library/importlib.metadata.rst:235 msgid "" "Every `Distribution Package `_ includes some metadata, which you can extract " "using the :func:`!metadata` function::" msgstr "" -#: ../../library/importlib.metadata.rst:240 +#: ../../library/importlib.metadata.rst:238 msgid ">>> wheel_metadata = metadata('wheel')" msgstr ">>> wheel_metadata = metadata('wheel')" -#: ../../library/importlib.metadata.rst:242 +#: ../../library/importlib.metadata.rst:240 msgid "" "The keys of the returned data structure name the metadata keywords, and the " "values are returned unparsed from the distribution metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:245 +#: ../../library/importlib.metadata.rst:243 msgid "" ">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -406,13 +405,13 @@ msgstr "" ">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:248 +#: ../../library/importlib.metadata.rst:246 msgid "" ":class:`PackageMetadata` also presents a :attr:`!json` attribute that " "returns all the metadata in a JSON-compatible form per :PEP:`566`::" msgstr "" -#: ../../library/importlib.metadata.rst:251 +#: ../../library/importlib.metadata.rst:249 msgid "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -420,43 +419,43 @@ msgstr "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:254 -#: ../../library/importlib.metadata.rst:453 +#: ../../library/importlib.metadata.rst:252 +#: ../../library/importlib.metadata.rst:451 msgid "" "The full set of available metadata is not described here. See the PyPA `Core " "metadata specification `_ for additional details." msgstr "" -#: ../../library/importlib.metadata.rst:257 +#: ../../library/importlib.metadata.rst:255 msgid "" "The ``Description`` is now included in the metadata when presented through " "the payload. Line continuation characters have been removed." msgstr "" -#: ../../library/importlib.metadata.rst:261 +#: ../../library/importlib.metadata.rst:259 msgid "The ``json`` attribute was added." msgstr "新增 ``json`` 屬性。" -#: ../../library/importlib.metadata.rst:267 +#: ../../library/importlib.metadata.rst:265 msgid "Distribution versions" msgstr "" -#: ../../library/importlib.metadata.rst:271 +#: ../../library/importlib.metadata.rst:269 msgid "" -"Return the installed distribution package `version `__ for " -"the named distribution package." +"Return the installed distribution package `version `__ for the named " +"distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:278 +#: ../../library/importlib.metadata.rst:276 msgid "" "The :func:`!version` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:282 +#: ../../library/importlib.metadata.rst:280 msgid "" ">>> version('wheel')\n" "'0.32.3'" @@ -464,38 +463,38 @@ msgstr "" ">>> version('wheel')\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:289 +#: ../../library/importlib.metadata.rst:287 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:293 +#: ../../library/importlib.metadata.rst:291 msgid "" "Return the full set of files contained within the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:299 +#: ../../library/importlib.metadata.rst:297 msgid "" "Returns :const:`None` if the distribution is found but the installation " "database records reporting the files associated with the distribution " "package are missing." msgstr "" -#: ../../library/importlib.metadata.rst:305 +#: ../../library/importlib.metadata.rst:303 msgid "" "A :class:`pathlib.PurePath` derived object with additional ``dist``, " "``size``, and ``hash`` properties corresponding to the distribution " "package's installation metadata for that file." msgstr "" -#: ../../library/importlib.metadata.rst:309 +#: ../../library/importlib.metadata.rst:307 msgid "" -"The :func:`!files` function takes a `Distribution Package `_ name " -"and returns all of the files installed by this distribution. Each file is " -"reported as a :class:`PackagePath` instance. For example::" +"The :func:`!files` function takes a `Distribution Package `_ name and returns " +"all of the files installed by this distribution. Each file is reported as a :" +"class:`PackagePath` instance. For example::" msgstr "" -#: ../../library/importlib.metadata.rst:314 +#: ../../library/importlib.metadata.rst:312 msgid "" ">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" ">>> util\n" @@ -517,11 +516,11 @@ msgstr "" ">>> util.hash\n" "" -#: ../../library/importlib.metadata.rst:324 +#: ../../library/importlib.metadata.rst:322 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:326 +#: ../../library/importlib.metadata.rst:324 msgid "" ">>> print(util.read_text())\n" "import base64\n" @@ -541,13 +540,13 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:335 +#: ../../library/importlib.metadata.rst:333 msgid "" "You can also use the :meth:`!locate` method to get the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:338 +#: ../../library/importlib.metadata.rst:336 msgid "" ">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" @@ -555,34 +554,33 @@ msgstr "" ">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:341 +#: ../../library/importlib.metadata.rst:339 msgid "" -"In the case where the metadata file listing files (``RECORD`` or " -"``SOURCES.txt``) is missing, :func:`!files` will return :const:`None`. The " -"caller may wish to wrap calls to :func:`!files` in `always_iterable `_ or otherwise guard against this " -"condition if the target distribution is not known to have the metadata " -"present." +"In the case where the metadata file listing files (``RECORD`` or ``SOURCES." +"txt``) is missing, :func:`!files` will return :const:`None`. The caller may " +"wish to wrap calls to :func:`!files` in `always_iterable `_ or otherwise guard against this condition if the target " +"distribution is not known to have the metadata present." msgstr "" -#: ../../library/importlib.metadata.rst:352 +#: ../../library/importlib.metadata.rst:350 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:356 +#: ../../library/importlib.metadata.rst:354 msgid "" "Return the declared dependency specifiers for the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:362 +#: ../../library/importlib.metadata.rst:360 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the :func:`!requires` function::" msgstr "" -#: ../../library/importlib.metadata.rst:366 +#: ../../library/importlib.metadata.rst:364 msgid "" ">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" @@ -590,34 +588,34 @@ msgstr "" ">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:374 +#: ../../library/importlib.metadata.rst:372 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:378 +#: ../../library/importlib.metadata.rst:376 msgid "" "Return a mapping from the top level module and import package names found " "via :data:`sys.meta_path` to the names of the distribution packages (if any) " "that provide the corresponding files." msgstr "" -#: ../../library/importlib.metadata.rst:382 +#: ../../library/importlib.metadata.rst:380 msgid "" "To allow for namespace packages (which may have members provided by multiple " "distribution packages), each top level import name maps to a list of " "distribution names rather than mapping directly to a single name." msgstr "" -#: ../../library/importlib.metadata.rst:386 +#: ../../library/importlib.metadata.rst:384 msgid "" -"A convenience method to resolve the `Distribution Package `_ name " -"(or names, in the case of a namespace package) that provide each importable " -"top-level Python module or `Import Package `_::" +"A convenience method to resolve the `Distribution Package `_ name (or names, " +"in the case of a namespace package) that provide each importable top-level " +"Python module or `Import Package `_::" msgstr "" -#: ../../library/importlib.metadata.rst:391 +#: ../../library/importlib.metadata.rst:389 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -627,46 +625,46 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:394 +#: ../../library/importlib.metadata.rst:392 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:403 +#: ../../library/importlib.metadata.rst:401 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:407 +#: ../../library/importlib.metadata.rst:405 msgid "" "Return a :class:`Distribution` instance describing the named distribution " "package." msgstr "" -#: ../../library/importlib.metadata.rst:415 +#: ../../library/importlib.metadata.rst:413 msgid "Details of an installed distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:417 +#: ../../library/importlib.metadata.rst:415 msgid "" "Note: different :class:`!Distribution` instances do not currently compare " "equal, even if they relate to the same installed distribution and " "accordingly have the same attributes." msgstr "" -#: ../../library/importlib.metadata.rst:421 +#: ../../library/importlib.metadata.rst:419 msgid "" "While the module level API described above is the most common and convenient " "usage, you can get all of that information from the :class:`!Distribution` " "class. :class:`!Distribution` is an abstract object that represents the " "metadata for a Python `Distribution Package `_. You can get the " -"concrete :class:`!Distribution` subclass instance for an installed " -"distribution package by calling the :func:`distribution` function::" +"latest/glossary/#term-Distribution-Package>`_. You can get the concrete :" +"class:`!Distribution` subclass instance for an installed distribution " +"package by calling the :func:`distribution` function::" msgstr "" -#: ../../library/importlib.metadata.rst:428 +#: ../../library/importlib.metadata.rst:426 msgid "" ">>> from importlib.metadata import distribution\n" ">>> dist = distribution('wheel')\n" @@ -678,13 +676,13 @@ msgstr "" ">>> type(dist)\n" "" -#: ../../library/importlib.metadata.rst:433 +#: ../../library/importlib.metadata.rst:431 msgid "" "Thus, an alternative way to get the version number is through the :class:`!" "Distribution` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:436 +#: ../../library/importlib.metadata.rst:434 msgid "" ">>> dist.version\n" "'0.32.3'" @@ -692,13 +690,13 @@ msgstr "" ">>> dist.version\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:439 +#: ../../library/importlib.metadata.rst:437 msgid "" "There are all kinds of additional metadata available on :class:`!" "Distribution` instances::" msgstr "" -#: ../../library/importlib.metadata.rst:442 +#: ../../library/importlib.metadata.rst:440 msgid "" ">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" @@ -710,13 +708,13 @@ msgstr "" ">>> dist.metadata['License']\n" "'MIT'" -#: ../../library/importlib.metadata.rst:447 +#: ../../library/importlib.metadata.rst:445 msgid "" "For editable packages, an ``origin`` property may present :pep:`610` " "metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:450 +#: ../../library/importlib.metadata.rst:448 msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" @@ -724,40 +722,39 @@ msgstr "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" -#: ../../library/importlib.metadata.rst:456 +#: ../../library/importlib.metadata.rst:454 msgid "The ``.origin`` property was added." msgstr "新增 ``.origin`` 屬性 (property)。" -#: ../../library/importlib.metadata.rst:460 +#: ../../library/importlib.metadata.rst:458 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:462 +#: ../../library/importlib.metadata.rst:460 msgid "" "By default, this package provides built-in support for discovery of metadata " -"for file system and zip file `Distribution Package `_\\s. " -"This metadata finder search defaults to ``sys.path``, but varies slightly in " -"how it interprets those values from how other import machinery does. In " -"particular:" +"for file system and zip file `Distribution Package `_\\s. This metadata " +"finder search defaults to ``sys.path``, but varies slightly in how it " +"interprets those values from how other import machinery does. In particular:" msgstr "" -#: ../../library/importlib.metadata.rst:466 +#: ../../library/importlib.metadata.rst:464 msgid "" "``importlib.metadata`` does not honor :class:`bytes` objects on ``sys.path``." msgstr "" -#: ../../library/importlib.metadata.rst:467 +#: ../../library/importlib.metadata.rst:465 msgid "" "``importlib.metadata`` will incidentally honor :py:class:`pathlib.Path` " "objects on ``sys.path`` even though such values will be ignored for imports." msgstr "" -#: ../../library/importlib.metadata.rst:471 +#: ../../library/importlib.metadata.rst:469 msgid "Implementing Custom Providers" msgstr "" -#: ../../library/importlib.metadata.rst:473 +#: ../../library/importlib.metadata.rst:471 msgid "" "``importlib.metadata`` address two API surfaces, one for *consumers* and " "another for *providers*. Most users are consumers, consuming metadata " @@ -766,34 +763,34 @@ msgid "" "custom importer. Such a use case calls for a *custom provider*." msgstr "" -#: ../../library/importlib.metadata.rst:480 +#: ../../library/importlib.metadata.rst:478 msgid "" "Because `Distribution Package `_ metadata is not available " -"through :data:`sys.path` searches, or package loaders directly, the metadata " -"for a distribution is found through import system :ref:`finders `_ metadata is not available through :" +"data:`sys.path` searches, or package loaders directly, the metadata for a " +"distribution is found through import system :ref:`finders `. To find a distribution package's metadata, ``importlib.metadata`` " -"queries the list of :term:`meta path finders ` " -"on :data:`sys.meta_path`." +"queries the list of :term:`meta path finders ` on :data:" +"`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:488 +#: ../../library/importlib.metadata.rst:486 msgid "" "The implementation has hooks integrated into the ``PathFinder``, serving " "metadata for distribution packages found on the file system." msgstr "" -#: ../../library/importlib.metadata.rst:491 +#: ../../library/importlib.metadata.rst:489 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " -"interface expected of finders by Python's import system. " -"``importlib.metadata`` extends this protocol by looking for an optional " +"interface expected of finders by Python's import system. ``importlib." +"metadata`` extends this protocol by looking for an optional " "``find_distributions`` callable on the finders from :data:`sys.meta_path` " "and presents this extended interface as the ``DistributionFinder`` abstract " "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:499 +#: ../../library/importlib.metadata.rst:497 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()) -> " @@ -803,14 +800,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:505 +#: ../../library/importlib.metadata.rst:503 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context sought by the consumer." msgstr "" -#: ../../library/importlib.metadata.rst:509 +#: ../../library/importlib.metadata.rst:507 msgid "" "In practice, to support finding distribution package metadata in locations " "other than the file system, subclass ``Distribution`` and implement the " @@ -818,15 +815,15 @@ msgid "" "derived ``Distribution`` in the ``find_distributions()`` method." msgstr "" -#: ../../library/importlib.metadata.rst:516 +#: ../../library/importlib.metadata.rst:514 msgid "Example" msgstr "範例" -#: ../../library/importlib.metadata.rst:518 +#: ../../library/importlib.metadata.rst:516 msgid "Imagine a custom finder that loads Python modules from a database::" msgstr "" -#: ../../library/importlib.metadata.rst:520 +#: ../../library/importlib.metadata.rst:518 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -846,14 +843,14 @@ msgstr "" "\n" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" -#: ../../library/importlib.metadata.rst:529 +#: ../../library/importlib.metadata.rst:527 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:534 +#: ../../library/importlib.metadata.rst:532 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -875,7 +872,7 @@ msgstr "" " for dist_record in self.db.query_distributions(query):\n" " yield DatabaseDistribution(dist_record)" -#: ../../library/importlib.metadata.rst:544 +#: ../../library/importlib.metadata.rst:542 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -884,7 +881,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:550 +#: ../../library/importlib.metadata.rst:548 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -897,11 +894,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:561 +#: ../../library/importlib.metadata.rst:559 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:563 +#: ../../library/importlib.metadata.rst:561 msgid "" "class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" @@ -924,14 +921,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:583 +#: ../../library/importlib.metadata.rst:581 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:588 +#: ../../library/importlib.metadata.rst:586 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.resources.po b/library/importlib.resources.po index eadd35afcf..010415fbe7 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-12 00:25+0000\n" +"POT-Creation-Date: 2026-05-01 00:34+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -67,44 +67,34 @@ msgstr "" #: ../../library/importlib.resources.rst:42 msgid "" -"This module provides functionality similar to `pkg_resources `_ `Basic Resource " -"Access `_ without the performance overhead of that package. This " -"makes reading resources included in packages easier, with more stable and " -"consistent semantics." -msgstr "" - -#: ../../library/importlib.resources.rst:50 -msgid "" "The standalone backport of this module provides more information on `using " "importlib.resources `_ and `migrating from pkg_resources to importlib.resources " "`_." msgstr "" -#: ../../library/importlib.resources.rst:56 +#: ../../library/importlib.resources.rst:48 msgid "" ":class:`Loaders ` that wish to support resource " "reading should implement a ``get_resource_reader(fullname)`` method as " "specified by :class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.resources.rst:62 +#: ../../library/importlib.resources.rst:54 msgid "" "Represents an anchor for resources, either a :class:`module object ` or a module name as a string. Defined as ``Union[str, " "ModuleType]``." msgstr "" -#: ../../library/importlib.resources.rst:68 +#: ../../library/importlib.resources.rst:60 msgid "" "Returns a :class:`~importlib.resources.abc.Traversable` object representing " "the resource container (think directory) and its resources (think files). A " "Traversable may contain other containers (think subdirectories)." msgstr "" -#: ../../library/importlib.resources.rst:73 +#: ../../library/importlib.resources.rst:65 msgid "" "*anchor* is an optional :class:`Anchor`. If the anchor is a package, " "resources are resolved from that package. If a module, resources are " @@ -112,7 +102,7 @@ msgid "" "If the anchor is omitted, the caller's module is used." msgstr "" -#: ../../library/importlib.resources.rst:81 +#: ../../library/importlib.resources.rst:73 msgid "" "*package* parameter was renamed to *anchor*. *anchor* can now be a non-" "package module and if omitted will default to the caller's module. *package* " @@ -121,7 +111,7 @@ msgid "" "``importlib_resources >= 5.10`` for a compatible interface on older Pythons." msgstr "" -#: ../../library/importlib.resources.rst:91 +#: ../../library/importlib.resources.rst:83 msgid "" "Given a :class:`~importlib.resources.abc.Traversable` object representing a " "file or directory, typically from :func:`importlib.resources.files`, return " @@ -129,60 +119,60 @@ msgid "" "manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:96 +#: ../../library/importlib.resources.rst:88 msgid "" "Exiting the context manager cleans up any temporary file or directory " "created when the resource was extracted from e.g. a zip file." msgstr "" -#: ../../library/importlib.resources.rst:99 +#: ../../library/importlib.resources.rst:91 msgid "" "Use ``as_file`` when the Traversable methods (``read_text``, etc) are " "insufficient and an actual file or directory on the file system is required." msgstr "" -#: ../../library/importlib.resources.rst:105 +#: ../../library/importlib.resources.rst:97 msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:112 +#: ../../library/importlib.resources.rst:104 msgid "Functional API" msgstr "" -#: ../../library/importlib.resources.rst:114 +#: ../../library/importlib.resources.rst:106 msgid "" "A set of simplified, backwards-compatible helpers is available. These allow " "common operations in a single function call." msgstr "" -#: ../../library/importlib.resources.rst:117 +#: ../../library/importlib.resources.rst:109 msgid "For all the following functions:" msgstr "" -#: ../../library/importlib.resources.rst:119 +#: ../../library/importlib.resources.rst:111 msgid "" "*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." "resources.files`. Unlike in ``files``, it may not be omitted." msgstr "" -#: ../../library/importlib.resources.rst:123 +#: ../../library/importlib.resources.rst:115 msgid "" "*path_names* are components of a resource's path name, relative to the " "anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:127 +#: ../../library/importlib.resources.rst:119 msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "importlib.resources.read_text(my_module, \"info.txt\")" -#: ../../library/importlib.resources.rst:129 +#: ../../library/importlib.resources.rst:121 msgid "" "Like :meth:`Traversable.joinpath `, The " "individual components should use forward slashes (``/``) as path separators. " "For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:134 +#: ../../library/importlib.resources.rst:126 msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" @@ -190,14 +180,14 @@ msgstr "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" -#: ../../library/importlib.resources.rst:137 +#: ../../library/importlib.resources.rst:129 msgid "" "For backward compatibility reasons, functions that read text require an " "explicit *encoding* argument if multiple *path_names* are given. For " "example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:141 +#: ../../library/importlib.resources.rst:133 msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" @@ -205,124 +195,124 @@ msgstr "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" -#: ../../library/importlib.resources.rst:146 +#: ../../library/importlib.resources.rst:138 msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:148 -#: ../../library/importlib.resources.rst:191 -#: ../../library/importlib.resources.rst:239 -#: ../../library/importlib.resources.rst:256 -#: ../../library/importlib.resources.rst:274 +#: ../../library/importlib.resources.rst:140 +#: ../../library/importlib.resources.rst:183 +#: ../../library/importlib.resources.rst:231 +#: ../../library/importlib.resources.rst:248 +#: ../../library/importlib.resources.rst:266 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*." msgstr "" -#: ../../library/importlib.resources.rst:151 +#: ../../library/importlib.resources.rst:143 msgid "" "This function returns a :class:`~typing.BinaryIO` object, that is, a binary " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:154 -#: ../../library/importlib.resources.rst:178 -#: ../../library/importlib.resources.rst:194 -#: ../../library/importlib.resources.rst:215 -#: ../../library/importlib.resources.rst:242 -#: ../../library/importlib.resources.rst:259 -#: ../../library/importlib.resources.rst:277 +#: ../../library/importlib.resources.rst:146 +#: ../../library/importlib.resources.rst:170 +#: ../../library/importlib.resources.rst:186 +#: ../../library/importlib.resources.rst:207 +#: ../../library/importlib.resources.rst:234 +#: ../../library/importlib.resources.rst:251 +#: ../../library/importlib.resources.rst:269 msgid "This function is roughly equivalent to::" msgstr "這個函式大致等同於: ::" -#: ../../library/importlib.resources.rst:156 +#: ../../library/importlib.resources.rst:148 msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(anchor).joinpath(*path_names).open('rb')" -#: ../../library/importlib.resources.rst:158 -#: ../../library/importlib.resources.rst:198 -#: ../../library/importlib.resources.rst:263 +#: ../../library/importlib.resources.rst:150 +#: ../../library/importlib.resources.rst:190 +#: ../../library/importlib.resources.rst:255 msgid "Multiple *path_names* are accepted." msgstr "多個 *path_names* 是被接受的。" -#: ../../library/importlib.resources.rst:164 +#: ../../library/importlib.resources.rst:156 msgid "" "Open the named resource for text reading. By default, the contents are read " "as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:167 -#: ../../library/importlib.resources.rst:207 +#: ../../library/importlib.resources.rst:159 +#: ../../library/importlib.resources.rst:199 msgid "" "See :ref:`the introduction ` for details on " "*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " "in built-in :func:`open`." msgstr "" -#: ../../library/importlib.resources.rst:171 -#: ../../library/importlib.resources.rst:211 +#: ../../library/importlib.resources.rst:163 +#: ../../library/importlib.resources.rst:203 msgid "" "For backward compatibility reasons, the *encoding* argument must be given " "explicitly if there are multiple *path_names*. This limitation is scheduled " "to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:175 +#: ../../library/importlib.resources.rst:167 msgid "" "This function returns a :class:`~typing.TextIO` object, that is, a text " "stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:180 +#: ../../library/importlib.resources.rst:172 msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:182 -#: ../../library/importlib.resources.rst:219 -#: ../../library/importlib.resources.rst:246 +#: ../../library/importlib.resources.rst:174 +#: ../../library/importlib.resources.rst:211 +#: ../../library/importlib.resources.rst:238 msgid "" "Multiple *path_names* are accepted. *encoding* and *errors* must be given as " "keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:189 +#: ../../library/importlib.resources.rst:181 msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "以 :class:`bytes` 形式讀取並回傳指定資源的內容。" -#: ../../library/importlib.resources.rst:196 +#: ../../library/importlib.resources.rst:188 msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(anchor).joinpath(*path_names).read_bytes()" -#: ../../library/importlib.resources.rst:204 +#: ../../library/importlib.resources.rst:196 msgid "" "Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:217 +#: ../../library/importlib.resources.rst:209 msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:226 +#: ../../library/importlib.resources.rst:218 msgid "" "Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:230 +#: ../../library/importlib.resources.rst:222 msgid "" "Exiting the context manager cleans up any temporary files created, e.g. when " "the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:233 +#: ../../library/importlib.resources.rst:225 msgid "" "For example, the :meth:`~pathlib.Path.stat` method requires an actual file " "system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:236 +#: ../../library/importlib.resources.rst:228 msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" @@ -330,21 +320,21 @@ msgstr "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" -#: ../../library/importlib.resources.rst:244 +#: ../../library/importlib.resources.rst:236 msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(anchor).joinpath(*path_names))" -#: ../../library/importlib.resources.rst:253 +#: ../../library/importlib.resources.rst:245 msgid "" "Return ``True`` if the named resource exists, otherwise ``False``. This " "function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:261 +#: ../../library/importlib.resources.rst:253 msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(anchor).joinpath(*path_names).is_file()" -#: ../../library/importlib.resources.rst:269 +#: ../../library/importlib.resources.rst:261 msgid "" "Return an iterable over the named items within the package or path. The " "iterable returns names of resources (e.g. files) and non-resources (e.g. " @@ -352,7 +342,7 @@ msgid "" "subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:279 +#: ../../library/importlib.resources.rst:271 msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" @@ -360,7 +350,7 @@ msgstr "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" -#: ../../library/importlib.resources.rst:282 +#: ../../library/importlib.resources.rst:274 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." diff --git a/library/itertools.po b/library/itertools.po index d20c39f2cf..ec3498485e 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-09 00:20+0000\n" +"POT-Creation-Date: 2026-04-25 00:26+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1808,6 +1808,7 @@ msgstr "" "term:`產生器 `,則能保持高速度。" #: ../../library/itertools.rst:831 +#, fuzzy msgid "" "from itertools import (accumulate, batched, chain, combinations, compress,\n" " count, cycle, filterfalse, groupby, islice, permutations, product,\n" @@ -1815,6 +1816,7 @@ msgid "" "from collections import Counter, deque\n" "from contextlib import suppress\n" "from functools import reduce\n" +"from heapq import heappush, heappushpop, heappush_max, heappushpop_max\n" "from math import comb, isqrt, prod, sumprod\n" "from operator import getitem, is_not, itemgetter, mul, neg, truediv\n" "\n" @@ -1830,11 +1832,6 @@ msgid "" " # prepend(1, [2, 3, 4]) → 1 2 3 4\n" " return chain([value], iterable)\n" "\n" -"def running_mean(iterable):\n" -" \"Yield the average of all values seen so far.\"\n" -" # running_mean([8.5, 9.5, 7.5, 6.5]) → 8.5 9.0 8.5 8.0\n" -" return map(truediv, accumulate(iterable), count(1))\n" -"\n" "def repeatfunc(function, times=None, *args):\n" " \"Repeat calls to a function with specified arguments.\"\n" " if times is None:\n" @@ -2134,7 +2131,50 @@ msgid "" " # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n" " for prime in set(factor(n)):\n" " n -= n // prime\n" -" return n" +" return n\n" +"\n" +"\n" +"# ==== Running statistics ====\n" +"\n" +"def running_mean(iterable):\n" +" \"Average of values seen so far.\"\n" +" # running_mean([37, 33, 38, 28]) → 37 35 36 34\n" +" return map(truediv, accumulate(iterable), count(1))\n" +"\n" +"def running_min(iterable):\n" +" \"Smallest of values seen so far.\"\n" +" # running_min([37, 33, 38, 28]) → 37 33 33 28\n" +" return accumulate(iterable, func=min)\n" +"\n" +"def running_max(iterable):\n" +" \"Largest of values seen so far.\"\n" +" # running_max([37, 33, 38, 28]) → 37 37 38 38\n" +" return accumulate(iterable, func=max)\n" +"\n" +"def running_median(iterable):\n" +" \"Median of values seen so far.\"\n" +" # running_median([37, 33, 38, 28]) → 37 35 37 35\n" +" read = iter(iterable).__next__\n" +" lo = [] # max-heap\n" +" hi = [] # min-heap the same size as or one smaller than lo\n" +" with suppress(StopIteration):\n" +" while True:\n" +" heappush_max(lo, heappushpop(hi, read()))\n" +" yield lo[0]\n" +" heappush(hi, heappushpop_max(lo, read()))\n" +" yield (lo[0] + hi[0]) / 2\n" +"\n" +"def running_statistics(iterable):\n" +" \"Aggregate statistics for values seen so far.\"\n" +" # Generate tuples: (size, minimum, median, maximum, mean)\n" +" t0, t1, t2, t3 = tee(iterable, 4)\n" +" return zip(\n" +" count(1),\n" +" running_min(t0),\n" +" running_median(t1),\n" +" running_max(t2),\n" +" running_mean(t3),\n" +" )" msgstr "" "from itertools import (accumulate, batched, chain, combinations, compress,\n" " count, cycle, filterfalse, groupby, islice, permutations, product,\n" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index e3093d27ac..0fb4095a42 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-04-13 00:26+0000\n" +"POT-Creation-Date: 2026-04-28 00:31+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2005,8 +2005,8 @@ msgstr "" #: ../../library/multiprocessing.rst:1333 msgid "" -"If *offset* is given then data is read from that position in *buffer*. If " -"*size* is given then that many bytes will be read from buffer. Very large " +"If *offset* is given then data is read from that position in *buf*. If " +"*size* is given then that many bytes will be read from *buf*. Very large " "buffers (approximately 32 MiB+, though it depends on the OS) may raise a :" "exc:`ValueError` exception" msgstr "" @@ -2033,17 +2033,17 @@ msgstr "" #: ../../library/multiprocessing.rst:1356 msgid "" -"Read into *buffer* a complete message of byte data sent from the other end " -"of the connection and return the number of bytes in the message. Blocks " -"until there is something to receive. Raises :exc:`EOFError` if there is " -"nothing left to receive and the other end was closed." +"Read into *buf* a complete message of byte data sent from the other end of " +"the connection and return the number of bytes in the message. Blocks until " +"there is something to receive. Raises :exc:`EOFError` if there is nothing " +"left to receive and the other end was closed." msgstr "" #: ../../library/multiprocessing.rst:1362 msgid "" -"*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " +"*buf* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " -"must be a non-negative integer less than the length of *buffer* (in bytes)." +"must be a non-negative integer less than the length of *buf* (in bytes)." msgstr "" #: ../../library/multiprocessing.rst:1367 @@ -3537,7 +3537,7 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:2422 -#: ../../library/multiprocessing.rst:2988 +#: ../../library/multiprocessing.rst:2998 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." @@ -4176,11 +4176,24 @@ msgid "" "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2912 +#: ../../library/multiprocessing.rst:2910 +msgid "" +"This authentication protects :class:`Listener` and :func:`Client` " +"connections, which are reachable by address. It is not applied to the " +"anonymous pipes created by :func:`~multiprocessing.Pipe` or used internally " +"by :class:`~multiprocessing.Queue`. :mod:`multiprocessing` treats all local " +"processes running as the same user as trusted; on most operating systems " +"such processes can access each other's pipe file descriptors regardless. " +"Applications that require isolation between processes of the same user must " +"arrange it at the operating-system level -- for example, by running workers " +"under a different user account or in a sandbox." +msgstr "" + +#: ../../library/multiprocessing.rst:2922 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2914 +#: ../../library/multiprocessing.rst:2924 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -4188,27 +4201,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2921 +#: ../../library/multiprocessing.rst:2931 msgid "" "Returns the logger used by :mod:`!multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2924 +#: ../../library/multiprocessing.rst:2934 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2928 +#: ../../library/multiprocessing.rst:2938 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2935 +#: ../../library/multiprocessing.rst:2945 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4217,11 +4230,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2941 +#: ../../library/multiprocessing.rst:2951 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2943 +#: ../../library/multiprocessing.rst:2953 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4249,21 +4262,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2956 +#: ../../library/multiprocessing.rst:2966 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2960 +#: ../../library/multiprocessing.rst:2970 msgid "The :mod:`!multiprocessing.dummy` module" msgstr ":mod:`!multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2965 +#: ../../library/multiprocessing.rst:2975 msgid "" ":mod:`!multiprocessing.dummy` replicates the API of :mod:`!multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2970 +#: ../../library/multiprocessing.rst:2980 msgid "" "In particular, the ``Pool`` function provided by :mod:`!multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4271,7 +4284,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2978 +#: ../../library/multiprocessing.rst:2988 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4281,18 +4294,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2985 +#: ../../library/multiprocessing.rst:2995 msgid "" "*processes* is the number of worker threads to use. If *processes* is " "``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2991 +#: ../../library/multiprocessing.rst:3001 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2995 +#: ../../library/multiprocessing.rst:3005 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -4302,7 +4315,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:3002 +#: ../../library/multiprocessing.rst:3012 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4311,69 +4324,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:3012 +#: ../../library/multiprocessing.rst:3022 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:3014 +#: ../../library/multiprocessing.rst:3024 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`!multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:3019 +#: ../../library/multiprocessing.rst:3029 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:3021 +#: ../../library/multiprocessing.rst:3031 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:3023 +#: ../../library/multiprocessing.rst:3033 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:3025 +#: ../../library/multiprocessing.rst:3035 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:3028 +#: ../../library/multiprocessing.rst:3038 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:3032 +#: ../../library/multiprocessing.rst:3042 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:3034 +#: ../../library/multiprocessing.rst:3044 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:3036 +#: ../../library/multiprocessing.rst:3046 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:3038 +#: ../../library/multiprocessing.rst:3048 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:3041 +#: ../../library/multiprocessing.rst:3051 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:3043 +#: ../../library/multiprocessing.rst:3053 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:3045 +#: ../../library/multiprocessing.rst:3055 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -4384,11 +4397,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:3053 +#: ../../library/multiprocessing.rst:3063 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:3055 +#: ../../library/multiprocessing.rst:3065 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:`!" "multiprocessing` need to be picklable so that child processes can use them. " @@ -4398,11 +4411,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:3063 +#: ../../library/multiprocessing.rst:3073 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:3065 +#: ../../library/multiprocessing.rst:3075 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4410,18 +4423,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:3071 +#: ../../library/multiprocessing.rst:3081 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:3075 +#: ../../library/multiprocessing.rst:3085 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:3077 +#: ../../library/multiprocessing.rst:3087 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -4430,7 +4443,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:3083 +#: ../../library/multiprocessing.rst:3093 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4439,11 +4452,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:3089 +#: ../../library/multiprocessing.rst:3099 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:3091 +#: ../../library/multiprocessing.rst:3101 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4458,17 +4471,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:3103 +#: ../../library/multiprocessing.rst:3113 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:3106 +#: ../../library/multiprocessing.rst:3116 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:3108 +#: ../../library/multiprocessing.rst:3118 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4476,7 +4489,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:3113 +#: ../../library/multiprocessing.rst:3123 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4485,11 +4498,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:3120 +#: ../../library/multiprocessing.rst:3130 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:3122 +#: ../../library/multiprocessing.rst:3132 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4511,11 +4524,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:3132 +#: ../../library/multiprocessing.rst:3142 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:3134 +#: ../../library/multiprocessing.rst:3144 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4537,25 +4550,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:3144 +#: ../../library/multiprocessing.rst:3154 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:3146 +#: ../../library/multiprocessing.rst:3156 msgid ":mod:`!multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:3148 +#: ../../library/multiprocessing.rst:3158 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:3150 +#: ../../library/multiprocessing.rst:3160 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:3153 +#: ../../library/multiprocessing.rst:3163 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4563,7 +4576,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:3156 +#: ../../library/multiprocessing.rst:3166 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4573,14 +4586,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:3163 +#: ../../library/multiprocessing.rst:3173 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:3167 +#: ../../library/multiprocessing.rst:3177 msgid "" "@property\n" "def cache(self):\n" @@ -4598,26 +4611,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:3175 +#: ../../library/multiprocessing.rst:3185 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:3181 +#: ../../library/multiprocessing.rst:3191 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:3183 +#: ../../library/multiprocessing.rst:3193 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:3186 +#: ../../library/multiprocessing.rst:3196 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:3188 +#: ../../library/multiprocessing.rst:3198 msgid "" "Ensure that all arguments to :class:`~multiprocessing.Process` are " "picklable. Also, if you subclass ``Process.__init__``, you must make sure " @@ -4625,11 +4638,11 @@ msgid "" "` method is called." msgstr "" -#: ../../library/multiprocessing.rst:3193 +#: ../../library/multiprocessing.rst:3203 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:3195 +#: ../../library/multiprocessing.rst:3205 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -4637,30 +4650,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:3200 +#: ../../library/multiprocessing.rst:3210 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:3205 +#: ../../library/multiprocessing.rst:3215 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:3207 +#: ../../library/multiprocessing.rst:3217 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3211 +#: ../../library/multiprocessing.rst:3221 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3215 +#: ../../library/multiprocessing.rst:3225 msgid "" "from multiprocessing import Process\n" "\n" @@ -4678,13 +4691,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3223 +#: ../../library/multiprocessing.rst:3233 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3226 +#: ../../library/multiprocessing.rst:3236 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4708,33 +4721,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3237 +#: ../../library/multiprocessing.rst:3247 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3240 +#: ../../library/multiprocessing.rst:3250 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3243 +#: ../../library/multiprocessing.rst:3253 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3250 +#: ../../library/multiprocessing.rst:3260 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3252 +#: ../../library/multiprocessing.rst:3262 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3254 +#: ../../library/multiprocessing.rst:3264 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4828,11 +4841,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3258 +#: ../../library/multiprocessing.rst:3268 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3260 +#: ../../library/multiprocessing.rst:3270 msgid "" "import multiprocessing\n" "import time\n" @@ -4992,13 +5005,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3264 +#: ../../library/multiprocessing.rst:3274 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3267 +#: ../../library/multiprocessing.rst:3277 msgid "" "import time\n" "import random\n" diff --git a/library/os.po b/library/os.po index a8ac1c1a11..f4679a29f9 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-12 00:16+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -377,25 +377,25 @@ msgstr "" #: ../../library/os.rst:4635 ../../library/os.rst:4642 #: ../../library/os.rst:4653 ../../library/os.rst:4663 #: ../../library/os.rst:4672 ../../library/os.rst:4704 -#: ../../library/os.rst:4816 ../../library/os.rst:4832 -#: ../../library/os.rst:4865 ../../library/os.rst:4934 -#: ../../library/os.rst:4957 ../../library/os.rst:4968 -#: ../../library/os.rst:4980 ../../library/os.rst:5025 -#: ../../library/os.rst:5062 ../../library/os.rst:5085 -#: ../../library/os.rst:5106 ../../library/os.rst:5140 -#: ../../library/os.rst:5181 ../../library/os.rst:5201 -#: ../../library/os.rst:5215 ../../library/os.rst:5232 -#: ../../library/os.rst:5247 ../../library/os.rst:5258 -#: ../../library/os.rst:5270 ../../library/os.rst:5283 -#: ../../library/os.rst:5292 ../../library/os.rst:5302 -#: ../../library/os.rst:5315 ../../library/os.rst:5350 -#: ../../library/os.rst:5366 ../../library/os.rst:5377 -#: ../../library/os.rst:5389 ../../library/os.rst:5396 -#: ../../library/os.rst:5405 ../../library/os.rst:5414 -#: ../../library/os.rst:5423 ../../library/os.rst:5432 -#: ../../library/os.rst:5596 ../../library/os.rst:5605 -#: ../../library/os.rst:5629 ../../library/os.rst:5656 -#: ../../library/os.rst:5665 ../../library/os.rst:5788 +#: ../../library/os.rst:4815 ../../library/os.rst:4831 +#: ../../library/os.rst:4864 ../../library/os.rst:4933 +#: ../../library/os.rst:4955 ../../library/os.rst:4966 +#: ../../library/os.rst:4978 ../../library/os.rst:5023 +#: ../../library/os.rst:5060 ../../library/os.rst:5083 +#: ../../library/os.rst:5104 ../../library/os.rst:5138 +#: ../../library/os.rst:5179 ../../library/os.rst:5199 +#: ../../library/os.rst:5213 ../../library/os.rst:5230 +#: ../../library/os.rst:5245 ../../library/os.rst:5256 +#: ../../library/os.rst:5268 ../../library/os.rst:5281 +#: ../../library/os.rst:5290 ../../library/os.rst:5300 +#: ../../library/os.rst:5313 ../../library/os.rst:5348 +#: ../../library/os.rst:5364 ../../library/os.rst:5375 +#: ../../library/os.rst:5387 ../../library/os.rst:5394 +#: ../../library/os.rst:5403 ../../library/os.rst:5412 +#: ../../library/os.rst:5421 ../../library/os.rst:5430 +#: ../../library/os.rst:5594 ../../library/os.rst:5603 +#: ../../library/os.rst:5627 ../../library/os.rst:5654 +#: ../../library/os.rst:5663 ../../library/os.rst:5786 msgid "Availability" msgstr "可用性" @@ -964,7 +964,7 @@ msgid "" "on iOS and Android." msgstr "" -#: ../../library/os.rst:819 ../../library/os.rst:5087 +#: ../../library/os.rst:819 ../../library/os.rst:5085 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." @@ -1530,7 +1530,7 @@ msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" #: ../../library/os.rst:1306 ../../library/os.rst:1657 -#: ../../library/os.rst:1892 ../../library/os.rst:5183 +#: ../../library/os.rst:1892 ../../library/os.rst:5181 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -1551,7 +1551,7 @@ msgstr "" #: ../../library/os.rst:3594 ../../library/os.rst:3634 #: ../../library/os.rst:3734 ../../library/os.rst:3795 #: ../../library/os.rst:4192 ../../library/os.rst:4372 -#: ../../library/os.rst:4941 +#: ../../library/os.rst:4940 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -5306,36 +5306,34 @@ msgid "" "encodings." msgstr "" -#: ../../library/os.rst:4714 -msgid "" -"The function is :term:`soft deprecated` and should no longer be used to " -"write new code. The :mod:`subprocess` module is recommended instead." +#: ../../library/os.rst:4714 ../../library/os.rst:4943 +msgid "The :mod:`subprocess` module is recommended instead." msgstr "" -#: ../../library/os.rst:4723 +#: ../../library/os.rst:4722 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4725 +#: ../../library/os.rst:4724 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4727 +#: ../../library/os.rst:4726 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`. *env* is allowed to be ``None``, in which case current process' " "environment is used." msgstr "" -#: ../../library/os.rst:4731 +#: ../../library/os.rst:4730 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4735 +#: ../../library/os.rst:4734 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5344,39 +5342,39 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4743 +#: ../../library/os.rst:4742 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4745 +#: ../../library/os.rst:4744 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4749 +#: ../../library/os.rst:4748 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4751 +#: ../../library/os.rst:4750 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4755 +#: ../../library/os.rst:4754 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4757 +#: ../../library/os.rst:4756 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4761 +#: ../../library/os.rst:4760 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4763 +#: ../../library/os.rst:4762 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4765 +#: ../../library/os.rst:4764 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" @@ -5386,7 +5384,7 @@ msgid "" "c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4772 +#: ../../library/os.rst:4771 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5395,7 +5393,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4778 +#: ../../library/os.rst:4777 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5406,7 +5404,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4786 +#: ../../library/os.rst:4785 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5414,7 +5412,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4791 +#: ../../library/os.rst:4790 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5422,14 +5420,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4796 +#: ../../library/os.rst:4795 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4800 +#: ../../library/os.rst:4799 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5439,7 +5437,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4807 ../../library/os.rst:4828 +#: ../../library/os.rst:4806 ../../library/os.rst:4827 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5447,79 +5445,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4811 +#: ../../library/os.rst:4810 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4822 +#: ../../library/os.rst:4821 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4824 +#: ../../library/os.rst:4823 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4834 +#: ../../library/os.rst:4833 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4840 +#: ../../library/os.rst:4839 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4845 +#: ../../library/os.rst:4844 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4846 +#: ../../library/os.rst:4845 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4848 +#: ../../library/os.rst:4847 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4850 +#: ../../library/os.rst:4849 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4854 +#: ../../library/os.rst:4853 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4859 +#: ../../library/os.rst:4858 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4863 +#: ../../library/os.rst:4862 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4879 +#: ../../library/os.rst:4878 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4881 +#: ../../library/os.rst:4880 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5527,7 +5525,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4886 +#: ../../library/os.rst:4885 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5536,13 +5534,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4892 +#: ../../library/os.rst:4891 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4895 +#: ../../library/os.rst:4894 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5554,7 +5552,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4904 +#: ../../library/os.rst:4903 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5567,7 +5565,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4914 +#: ../../library/os.rst:4913 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5579,13 +5577,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4923 +#: ../../library/os.rst:4922 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4926 +#: ../../library/os.rst:4925 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5599,7 +5597,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4932 +#: ../../library/os.rst:4931 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5607,7 +5605,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4936 +#: ../../library/os.rst:4935 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5615,13 +5613,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4944 -msgid "" -"These functions are :term:`soft deprecated` and should no longer be used to " -"write new code. The :mod:`subprocess` module is recommended instead." -msgstr "" - -#: ../../library/os.rst:4952 +#: ../../library/os.rst:4950 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5629,7 +5621,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4962 +#: ../../library/os.rst:4960 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5638,7 +5630,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4974 +#: ../../library/os.rst:4972 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5648,11 +5640,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:4983 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:4985 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5660,7 +5652,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4992 +#: ../../library/os.rst:4990 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5668,28 +5660,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4997 +#: ../../library/os.rst:4995 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:5001 +#: ../../library/os.rst:4999 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:5005 +#: ../../library/os.rst:5003 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:5009 +#: ../../library/os.rst:5007 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5700,14 +5692,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:5017 +#: ../../library/os.rst:5015 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:5021 +#: ../../library/os.rst:5019 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5715,7 +5707,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:5023 +#: ../../library/os.rst:5021 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5723,13 +5715,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:5027 +#: ../../library/os.rst:5025 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:5034 +#: ../../library/os.rst:5032 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5740,13 +5732,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:5042 +#: ../../library/os.rst:5040 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5043 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5755,7 +5747,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:5051 +#: ../../library/os.rst:5049 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is recommended " @@ -5763,54 +5755,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:5056 +#: ../../library/os.rst:5054 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:5060 +#: ../../library/os.rst:5058 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:5067 +#: ../../library/os.rst:5065 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:5070 +#: ../../library/os.rst:5068 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:5071 +#: ../../library/os.rst:5069 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:5072 +#: ../../library/os.rst:5070 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:5073 +#: ../../library/os.rst:5071 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:5074 +#: ../../library/os.rst:5072 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:5076 +#: ../../library/os.rst:5074 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:5080 +#: ../../library/os.rst:5078 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5820,7 +5812,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:5094 +#: ../../library/os.rst:5092 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5829,87 +5821,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5100 +#: ../../library/os.rst:5098 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5103 ../../library/os.rst:5178 +#: ../../library/os.rst:5101 ../../library/os.rst:5176 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5110 +#: ../../library/os.rst:5108 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5117 +#: ../../library/os.rst:5115 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5119 +#: ../../library/os.rst:5117 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5122 +#: ../../library/os.rst:5120 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5126 +#: ../../library/os.rst:5124 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5129 +#: ../../library/os.rst:5127 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5130 +#: ../../library/os.rst:5128 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5131 +#: ../../library/os.rst:5129 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5132 +#: ../../library/os.rst:5130 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5133 +#: ../../library/os.rst:5131 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5135 +#: ../../library/os.rst:5133 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5144 +#: ../../library/os.rst:5142 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5150 +#: ../../library/os.rst:5148 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5152 +#: ../../library/os.rst:5150 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5918,7 +5910,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5155 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5928,7 +5920,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5164 +#: ../../library/os.rst:5162 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5937,7 +5929,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5170 +#: ../../library/os.rst:5168 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5949,7 +5941,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:5191 +#: ../../library/os.rst:5189 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5958,13 +5950,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5198 ../../library/os.rst:5212 +#: ../../library/os.rst:5196 ../../library/os.rst:5210 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5206 +#: ../../library/os.rst:5204 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5973,118 +5965,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5223 +#: ../../library/os.rst:5221 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5226 +#: ../../library/os.rst:5224 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5227 +#: ../../library/os.rst:5225 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5228 +#: ../../library/os.rst:5226 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5229 +#: ../../library/os.rst:5227 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5234 +#: ../../library/os.rst:5232 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5237 +#: ../../library/os.rst:5235 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5243 +#: ../../library/os.rst:5241 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5252 +#: ../../library/os.rst:5250 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5255 +#: ../../library/os.rst:5253 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5265 +#: ../../library/os.rst:5263 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5268 ../../library/os.rst:5300 +#: ../../library/os.rst:5266 ../../library/os.rst:5298 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5277 +#: ../../library/os.rst:5275 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5281 +#: ../../library/os.rst:5279 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5288 +#: ../../library/os.rst:5286 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5295 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5312 +#: ../../library/os.rst:5310 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5319 +#: ../../library/os.rst:5317 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "新增 :data:`CLD_KILLED` 和 :data:`CLD_STOPPED` 值。" -#: ../../library/os.rst:5325 +#: ../../library/os.rst:5323 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5327 +#: ../../library/os.rst:5325 msgid "On Unix:" msgstr "在 Unix 上:" -#: ../../library/os.rst:5329 +#: ../../library/os.rst:5327 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5332 +#: ../../library/os.rst:5330 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -6092,15 +6084,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5336 +#: ../../library/os.rst:5334 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "否則,引發 :exc:`ValueError`。" -#: ../../library/os.rst:5338 +#: ../../library/os.rst:5336 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5340 +#: ../../library/os.rst:5338 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -6108,234 +6100,234 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5347 +#: ../../library/os.rst:5345 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:5355 +#: ../../library/os.rst:5353 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5361 +#: ../../library/os.rst:5359 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5364 ../../library/os.rst:5430 +#: ../../library/os.rst:5362 ../../library/os.rst:5428 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5371 +#: ../../library/os.rst:5369 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5375 +#: ../../library/os.rst:5373 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5382 +#: ../../library/os.rst:5380 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5385 +#: ../../library/os.rst:5383 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5393 +#: ../../library/os.rst:5391 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5401 +#: ../../library/os.rst:5399 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5408 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5412 +#: ../../library/os.rst:5410 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5419 +#: ../../library/os.rst:5417 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5421 +#: ../../library/os.rst:5419 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5428 +#: ../../library/os.rst:5426 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5436 +#: ../../library/os.rst:5434 msgid "Interface to the scheduler" msgstr "排程器介面" -#: ../../library/os.rst:5438 +#: ../../library/os.rst:5436 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5444 +#: ../../library/os.rst:5442 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5451 +#: ../../library/os.rst:5449 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5455 +#: ../../library/os.rst:5453 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5460 +#: ../../library/os.rst:5458 msgid "Scheduling policy for tasks with deadline constraints." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5464 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5470 +#: ../../library/os.rst:5468 msgid "Alias for :data:`SCHED_OTHER`." msgstr ":data:`SCHED_OTHER` 的別名。" -#: ../../library/os.rst:5476 +#: ../../library/os.rst:5474 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5480 +#: ../../library/os.rst:5478 msgid "A First In First Out scheduling policy." msgstr "先進先出排程策略。" -#: ../../library/os.rst:5484 +#: ../../library/os.rst:5482 msgid "A round-robin scheduling policy." msgstr "輪轉排程策略。" -#: ../../library/os.rst:5488 +#: ../../library/os.rst:5486 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5495 +#: ../../library/os.rst:5493 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5499 +#: ../../library/os.rst:5497 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5503 +#: ../../library/os.rst:5501 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5508 +#: ../../library/os.rst:5506 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5514 +#: ../../library/os.rst:5512 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5520 +#: ../../library/os.rst:5518 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5527 +#: ../../library/os.rst:5525 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5534 +#: ../../library/os.rst:5532 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5540 +#: ../../library/os.rst:5538 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5546 +#: ../../library/os.rst:5544 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5552 +#: ../../library/os.rst:5550 msgid "" "Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5557 +#: ../../library/os.rst:5555 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5564 +#: ../../library/os.rst:5562 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5566 +#: ../../library/os.rst:5564 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5569 +#: ../../library/os.rst:5567 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5575 +#: ../../library/os.rst:5573 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5580 +#: ../../library/os.rst:5578 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6346,13 +6338,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5588 +#: ../../library/os.rst:5586 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5591 +#: ../../library/os.rst:5589 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -6360,62 +6352,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5601 +#: ../../library/os.rst:5599 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5610 +#: ../../library/os.rst:5608 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5613 +#: ../../library/os.rst:5611 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5618 +#: ../../library/os.rst:5616 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the override value *n*." msgstr "" -#: ../../library/os.rst:5625 +#: ../../library/os.rst:5623 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5634 +#: ../../library/os.rst:5632 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " "process**. Returns ``None`` if undetermined. It can be less than :func:" "`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5638 +#: ../../library/os.rst:5636 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5641 +#: ../../library/os.rst:5639 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the override value *n*." msgstr "" -#: ../../library/os.rst:5644 +#: ../../library/os.rst:5642 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5651 +#: ../../library/os.rst:5649 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6424,44 +6416,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5661 +#: ../../library/os.rst:5659 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5667 +#: ../../library/os.rst:5665 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "新增 ``'SC_MINSIGSTKSZ'`` 名稱。" -#: ../../library/os.rst:5670 +#: ../../library/os.rst:5668 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5673 +#: ../../library/os.rst:5671 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5679 +#: ../../library/os.rst:5677 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5687 +#: ../../library/os.rst:5685 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5694 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6470,7 +6462,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5706 +#: ../../library/os.rst:5704 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6478,27 +6470,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5715 +#: ../../library/os.rst:5713 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5723 +#: ../../library/os.rst:5721 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5730 +#: ../../library/os.rst:5728 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5737 +#: ../../library/os.rst:5735 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6507,36 +6499,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5746 +#: ../../library/os.rst:5744 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5757 +#: ../../library/os.rst:5755 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5765 +#: ../../library/os.rst:5763 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5770 +#: ../../library/os.rst:5768 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5773 +#: ../../library/os.rst:5771 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5776 +#: ../../library/os.rst:5774 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6544,32 +6536,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5781 +#: ../../library/os.rst:5779 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5785 +#: ../../library/os.rst:5783 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5794 +#: ../../library/os.rst:5792 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5796 +#: ../../library/os.rst:5794 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5800 +#: ../../library/os.rst:5798 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6579,63 +6571,63 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5807 +#: ../../library/os.rst:5805 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5811 +#: ../../library/os.rst:5809 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5814 +#: ../../library/os.rst:5812 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5818 +#: ../../library/os.rst:5816 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5824 +#: ../../library/os.rst:5822 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5828 +#: ../../library/os.rst:5826 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5832 +#: ../../library/os.rst:5830 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5838 +#: ../../library/os.rst:5836 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5842 +#: ../../library/os.rst:5840 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5849 +#: ../../library/os.rst:5847 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." @@ -6745,40 +6737,40 @@ msgstr "" msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5676 ../../library/os.rst:5712 +#: ../../library/os.rst:5674 ../../library/os.rst:5710 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5676 ../../library/os.rst:5684 -#: ../../library/os.rst:5692 ../../library/os.rst:5703 -#: ../../library/os.rst:5712 +#: ../../library/os.rst:5674 ../../library/os.rst:5682 +#: ../../library/os.rst:5690 ../../library/os.rst:5701 +#: ../../library/os.rst:5710 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5684 +#: ../../library/os.rst:5682 msgid ".." msgstr ".." -#: ../../library/os.rst:5692 ../../library/os.rst:5703 +#: ../../library/os.rst:5690 ../../library/os.rst:5701 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5693 +#: ../../library/os.rst:5691 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5693 +#: ../../library/os.rst:5691 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5719 +#: ../../library/os.rst:5717 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/re.po b/library/re.po index 4e3f463494..9ef686009f 100644 --- a/library/re.po +++ b/library/re.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-22 00:18+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3042,7 +3042,7 @@ msgid "" "\n" "class Token(NamedTuple):\n" " type: str\n" -" value: str\n" +" value: int | float | str\n" " line: int\n" " column: int\n" "\n" diff --git a/library/struct.po b/library/struct.po index d9aa23f933..0e89d56727 100644 --- a/library/struct.po +++ b/library/struct.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-28 00:21+0000\n" +"POT-Creation-Date: 2026-04-28 00:31+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -446,12 +446,17 @@ msgstr ":c:expr:`signed char`" #: ../../library/struct.rst:248 ../../library/struct.rst:250 #: ../../library/struct.rst:253 ../../library/struct.rst:255 #: ../../library/struct.rst:271 -msgid "integer" +#, fuzzy +msgid "int" msgstr "整數" -#: ../../library/struct.rst:230 -msgid "\\(1), \\(2)" -msgstr "\\(1), \\(2)" +#: ../../library/struct.rst:230 ../../library/struct.rst:232 +#: ../../library/struct.rst:236 ../../library/struct.rst:238 +#: ../../library/struct.rst:240 ../../library/struct.rst:242 +#: ../../library/struct.rst:244 ../../library/struct.rst:246 +#: ../../library/struct.rst:248 ../../library/struct.rst:250 +msgid "\\(2)" +msgstr "\\(2)" #: ../../library/struct.rst:232 msgid "``B``" @@ -461,14 +466,6 @@ msgstr "``B``" msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../library/struct.rst:232 ../../library/struct.rst:236 -#: ../../library/struct.rst:238 ../../library/struct.rst:240 -#: ../../library/struct.rst:242 ../../library/struct.rst:244 -#: ../../library/struct.rst:246 ../../library/struct.rst:248 -#: ../../library/struct.rst:250 -msgid "\\(2)" -msgstr "\\(2)" - #: ../../library/struct.rst:234 msgid "``?``" msgstr "``?``" @@ -574,8 +571,9 @@ msgid ":c:type:`ssize_t`" msgstr ":c:type:`ssize_t`" #: ../../library/struct.rst:253 ../../library/struct.rst:255 -msgid "\\(3)" -msgstr "\\(3)" +#, fuzzy +msgid "\\(2), \\(3)" +msgstr "\\(1), \\(2)" #: ../../library/struct.rst:255 msgid "``N``" @@ -683,8 +681,9 @@ msgid ":c:expr:`void \\*`" msgstr ":c:expr:`void \\*`" #: ../../library/struct.rst:271 -msgid "\\(5)" -msgstr "\\(5)" +#, fuzzy +msgid "\\(2), \\(5)" +msgstr "\\(1), \\(2)" #: ../../library/struct.rst:274 msgid "Added support for the ``'n'`` and ``'N'`` formats." @@ -777,26 +776,28 @@ msgstr "" "準 `_\\ 修訂版中引入的。它有一個符號位元 (sign bit)、5 位" "元指數和 11 位元精度(明確儲存 10 位元),可以全精度表示大約 ``6.1e-05`` 到 " "``6.5e+04`` 之間的數字。此型別未被 C 編譯器廣泛支援:若編譯器支援 C23 標準的" -"附錄 H,則可以作為 :c:expr:`_Float16` 型別使用。在典型機器上,unsigned " -"short 可以用於儲存但不能用於數學運算。請參見 Wikipedia 上的\\ `半精度浮點數格" -"式 `_\\ 頁面以取得更多資訊。" +"附錄 H,則可以作為 :c:expr:`_Float16` 型別使用。在典型機器上,unsigned short " +"可以用於儲存但不能用於數學運算。請參見 Wikipedia 上的\\ `半精度浮點數格式 " +"`_\\ 頁面以取得更多資訊。" #: ../../library/struct.rst:339 msgid "When packing, ``'x'`` inserts one NUL byte." msgstr "打包時,``'x'`` 插入一個 NUL 位元組。" #: ../../library/struct.rst:342 +#, fuzzy msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " "count. The first byte stored is the length of the string, or 255, whichever " -"is smaller. The bytes of the string follow. If the string passed in to :" -"func:`pack` is too long (longer than the count minus 1), only the leading " -"``count-1`` bytes of the string are stored. If the string is shorter than " -"``count-1``, it is padded with null bytes so that exactly count bytes in all " -"are used. Note that for :func:`unpack`, the ``'p'`` format character " -"consumes ``count`` bytes, but that the string returned can never contain " -"more than 255 bytes." +"is smaller. The bytes of the string follow. If the byte string passed in " +"to :func:`pack` is too long (longer than the count minus 1), only the " +"leading ``count-1`` bytes of the string are stored. If the byte string is " +"shorter than ``count-1``, it is padded with null bytes so that exactly count " +"bytes in all are used. Note that for :func:`unpack`, the ``'p'`` format " +"character consumes ``count`` bytes, but that the :class:`!bytes` object " +"returned can never contain more than 255 bytes. When packing, arguments of " +"types :class:`bytes` and :class:`bytearray` are accepted." msgstr "" "``'p'`` 格式字元編碼一個「Pascal 字串」,意思是儲存在\\ *固定位元組數*\\ 中的" "短、長度可變字串,由計數指定。儲存的第一個位元組是字串的長度,或與 255 間取較" @@ -806,19 +807,22 @@ msgstr "" "``'p'`` 格式字元消耗 ``count`` 個位元組,但回傳的字串永遠不能包含超過 255 個" "位元組。" -#: ../../library/struct.rst:354 +#: ../../library/struct.rst:356 +#, fuzzy msgid "" "For the ``'s'`` format character, the count is interpreted as the length of " -"the bytes, not a repeat count like for the other format characters; for " -"example, ``'10s'`` means a single 10-byte string mapping to or from a single " -"Python byte string, while ``'10c'`` means 10 separate one byte character " -"elements (e.g., ``cccccccccc``) mapping to or from ten different Python byte " -"objects. (See :ref:`struct-examples` for a concrete demonstration of the " -"difference.) If a count is not given, it defaults to 1. For packing, the " -"string is truncated or padded with null bytes as appropriate to make it fit. " -"For unpacking, the resulting bytes object always has exactly the specified " -"number of bytes. As a special case, ``'0s'`` means a single, empty string " -"(while ``'0c'`` means 0 characters)." +"the byte string, not a repeat count like for the other format characters; " +"for example, ``'10s'`` means a single 10-byte string mapping to or from a " +"single Python byte string, while ``'10c'`` means 10 separate one byte " +"character elements (e.g., ``cccccccccc``) mapping to or from ten different " +"Python byte objects. (See :ref:`struct-examples` for a concrete " +"demonstration of the difference.) If a count is not given, it defaults to " +"1. For packing, the byte string is truncated or padded with null bytes as " +"appropriate to make it fit. For unpacking, the resulting :class:`!bytes` " +"object always has exactly the specified number of bytes. As a special case, " +"``'0s'`` means a single, empty byte string (while ``'0c'`` means 0 " +"characters). When packing, arguments of types :class:`bytes` and :class:" +"`bytearray` are accepted." msgstr "" "對於 ``'s'`` 格式字元,計數被直譯為位元組的長度,而不是像其他格式字元那樣的重" "複次數;例如,``'10s'`` 表示一個 10 位元組字串,對應於單一 Python 位元組字" @@ -828,7 +832,7 @@ msgstr "" "充字串以使其適合。解包時,結果位元組物件總是恰好具有指定的位元組數。作為特殊" "情況,``'0s'`` 表示單一空字串(而 ``'0c'`` 表示 0 個字元)。" -#: ../../library/struct.rst:368 +#: ../../library/struct.rst:372 msgid "" "For the ``'F'`` and ``'D'`` format characters, the packed representation " "uses the IEEE 754 binary32 and binary64 format for components of the complex " @@ -843,7 +847,7 @@ msgstr "" "C 中屬於可選功能,``F`` 和 ``D`` 仍然可以無條件使用。根據 C11 標準,每個複數" "型別由一個含有二個元素的 C 陣列表示,分別存放實部與虛部。" -#: ../../library/struct.rst:377 +#: ../../library/struct.rst:381 msgid "" "A format character may be preceded by an integral repeat count. For " "example, the format string ``'4h'`` means exactly the same as ``'hhhh'``." @@ -851,13 +855,13 @@ msgstr "" "格式字元前面可以加上整數重複次數。例如,格式字串 ``'4h'`` 與 ``'hhhh'`` 意思" "完全相同。" -#: ../../library/struct.rst:380 +#: ../../library/struct.rst:384 msgid "" "Whitespace characters between formats are ignored; a count and its format " "must not contain whitespace though." msgstr "格式之間的空白字元會被忽略;但是計數和其格式不能包含空白字元。" -#: ../../library/struct.rst:383 +#: ../../library/struct.rst:387 msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " @@ -868,7 +872,7 @@ msgstr "" "``'l'``、``'L'``、``'q'``、``'Q'``)打包數值 ``x`` 時,如果 ``x`` 超出該格式" "的有效範圍,則會觸發 :exc:`struct.error`。" -#: ../../library/struct.rst:388 +#: ../../library/struct.rst:392 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." @@ -876,7 +880,7 @@ msgstr "" "以前一些整數格式會環繞超出範圍的數值並引發 :exc:`DeprecationWarning` 而不是 :" "exc:`struct.error`。" -#: ../../library/struct.rst:394 +#: ../../library/struct.rst:398 msgid "" "For the ``'?'`` format character, the return value is either :const:`True` " "or :const:`False`. When packing, the truth value of the argument object is " @@ -887,11 +891,11 @@ msgstr "" "引數物件的真值。原生或標準布林值表示法中的 0 或 1 將被打包,解包時任何非零值" "都將為 ``True``。" -#: ../../library/struct.rst:404 +#: ../../library/struct.rst:408 msgid "Examples" msgstr "範例" -#: ../../library/struct.rst:407 +#: ../../library/struct.rst:411 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " @@ -900,13 +904,13 @@ msgstr "" "原生位元組順序範例(由 ``'@'`` 格式前綴或缺少任何前綴字元指定)可能與讀者機器" "產生的結果不符,因為這取決於平台和編譯器。" -#: ../../library/struct.rst:412 +#: ../../library/struct.rst:416 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "使用大端序打包和解包三種不同大小的整數: ::" -#: ../../library/struct.rst:415 +#: ../../library/struct.rst:419 msgid "" ">>> from struct import *\n" ">>> pack(\">bhl\", 1, 2, 3)\n" @@ -924,11 +928,11 @@ msgstr "" ">>> calcsize('>bhl')\n" "7" -#: ../../library/struct.rst:423 +#: ../../library/struct.rst:427 msgid "Attempt to pack an integer which is too large for the defined field::" msgstr "嘗試打包對於定義欄位來說太大的整數: ::" -#: ../../library/struct.rst:425 +#: ../../library/struct.rst:429 msgid "" ">>> pack(\">h\", 99999)\n" "Traceback (most recent call last):\n" @@ -940,12 +944,12 @@ msgstr "" " File \"\", line 1, in \n" "struct.error: 'h' format requires -32768 <= number <= 32767" -#: ../../library/struct.rst:430 +#: ../../library/struct.rst:434 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" msgstr "示範 ``'s'`` 和 ``'c'`` 格式字元之間的差異: ::" -#: ../../library/struct.rst:433 +#: ../../library/struct.rst:437 msgid "" ">>> pack(\"@ccc\", b'1', b'2', b'3')\n" "b'123'\n" @@ -957,13 +961,13 @@ msgstr "" ">>> pack(\"@3s\", b'123')\n" "b'123'" -#: ../../library/struct.rst:438 +#: ../../library/struct.rst:442 msgid "" "Unpacked fields can be named by assigning them to variables or by wrapping " "the result in a named tuple::" msgstr "解包的欄位可以透過將其指派給變數或將結果包裝在具名元組中來命名: ::" -#: ../../library/struct.rst:441 +#: ../../library/struct.rst:445 msgid "" ">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" ">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" @@ -981,7 +985,7 @@ msgstr "" ">>> Student._make(unpack('<10sHHb', record))\n" "Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" -#: ../../library/struct.rst:449 +#: ../../library/struct.rst:453 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -995,7 +999,7 @@ msgstr "" "``'#'`` 之後加入了三個 NUL 位元組,以將後續整數對齊到四位元組邊界。在此範例" "中,輸出是在小端序機器上產生的: ::" -#: ../../library/struct.rst:457 +#: ../../library/struct.rst:461 msgid "" ">>> pack('@ci', b'#', 0x12131415)\n" "b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" @@ -1015,7 +1019,7 @@ msgstr "" ">>> calcsize('@ic')\n" "5" -#: ../../library/struct.rst:466 +#: ../../library/struct.rst:470 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" @@ -1023,7 +1027,7 @@ msgstr "" "假設平台的 long 對齊到 4 位元組邊界,以下格式 ``'llh0l'`` 會在結尾加入兩個填" "充位元組: ::" -#: ../../library/struct.rst:469 +#: ../../library/struct.rst:473 msgid "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" @@ -1031,35 +1035,35 @@ msgstr "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" -#: ../../library/struct.rst:475 +#: ../../library/struct.rst:479 msgid "Module :mod:`array`" msgstr ":mod:`array` 模組" -#: ../../library/struct.rst:476 +#: ../../library/struct.rst:480 msgid "Packed binary storage of homogeneous data." msgstr "同質資料的打包二進位儲存。" -#: ../../library/struct.rst:478 +#: ../../library/struct.rst:482 msgid "Module :mod:`json`" msgstr ":mod:`json` 模組" -#: ../../library/struct.rst:479 +#: ../../library/struct.rst:483 msgid "JSON encoder and decoder." msgstr "JSON 編碼器和解碼器。" -#: ../../library/struct.rst:481 +#: ../../library/struct.rst:485 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/struct.rst:482 +#: ../../library/struct.rst:486 msgid "Python object serialization." msgstr "Python 物件序列化。" -#: ../../library/struct.rst:488 +#: ../../library/struct.rst:492 msgid "Applications" msgstr "應用" -#: ../../library/struct.rst:490 +#: ../../library/struct.rst:494 msgid "" "Two main applications for the :mod:`!struct` module exist, data interchange " "between Python and C code within an application or another application " @@ -1074,11 +1078,11 @@ msgstr "" "格式 `)。一般來說,為這兩個領域建構的格式字串是不同" "的。" -#: ../../library/struct.rst:501 +#: ../../library/struct.rst:505 msgid "Native Formats" msgstr "原生格式" -#: ../../library/struct.rst:503 +#: ../../library/struct.rst:507 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -1093,12 +1097,12 @@ msgstr "" "組通常會自動插入。可能需要在格式字串的結尾使用零重複格式碼來向上舍入到正確的" "位元組邊界,以便正確對齊連續的資料區塊 (chunks)。" -#: ../../library/struct.rst:511 +#: ../../library/struct.rst:515 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "考慮這兩個簡單範例(在 64 位元小端序機器上): ::" -#: ../../library/struct.rst:514 +#: ../../library/struct.rst:518 msgid "" ">>> calcsize('@lhl')\n" "24\n" @@ -1110,7 +1114,7 @@ msgstr "" ">>> calcsize('@llh')\n" "18" -#: ../../library/struct.rst:519 +#: ../../library/struct.rst:523 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " @@ -1119,7 +1123,7 @@ msgstr "" "在第二個格式字串的結尾,如果不使用額外填充,資料不會填充到 8 位元組邊界。零重" "複格式碼解決了這個問題: ::" -#: ../../library/struct.rst:523 +#: ../../library/struct.rst:527 msgid "" ">>> calcsize('@llh0l')\n" "24" @@ -1127,7 +1131,7 @@ msgstr "" ">>> calcsize('@llh0l')\n" "24" -#: ../../library/struct.rst:526 +#: ../../library/struct.rst:530 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." @@ -1135,17 +1139,17 @@ msgstr "" "``'x'`` 格式碼可以用來指定重複,但對於原生格式來說最好使用像 ``'0l'`` 這樣的" "零重複格式。" -#: ../../library/struct.rst:529 +#: ../../library/struct.rst:533 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "預設使用原生位元組順序和對齊,但最好明確使用 ``'@'`` 前綴字元。" -#: ../../library/struct.rst:536 +#: ../../library/struct.rst:540 msgid "Standard Formats" msgstr "標準格式" -#: ../../library/struct.rst:538 +#: ../../library/struct.rst:542 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -1165,7 +1169,7 @@ msgstr "" "計師的責任。零重複格式字元不會起作用。取而代之的是使用者必須在需要的地方明確" "加入 ``'x'`` 填充位元組。重新檢視上一節的範例,我們有: ::" -#: ../../library/struct.rst:550 +#: ../../library/struct.rst:554 msgid "" ">>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack(' (大於)" msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/struct.rst:293 ../../library/struct.rst:392 +#: ../../library/struct.rst:293 ../../library/struct.rst:396 msgid "? (question mark)" msgstr "? (問號)" +#~ msgid "\\(3)" +#~ msgstr "\\(3)" + +#~ msgid "\\(5)" +#~ msgstr "\\(5)" + #~ msgid "\\(6)" #~ msgstr "\\(6)" diff --git a/library/tomllib.po b/library/tomllib.po index 2638673c9b..e9222cfb3b 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-05-02 00:31+0000\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,11 +32,18 @@ msgid "" "Minimal Language, `https://toml.io `_). This module " "does not support writing TOML." msgstr "" -"此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://" -"toml.io `_) 的一個介面,此模組並不支援寫入 TOML。" +"此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://toml." +"io `_) 的一個介面,此模組並不支援寫入 TOML。" #: ../../library/tomllib.rst:22 msgid "" +"Be cautious when parsing data from untrusted sources. A malicious TOML " +"string may cause the decoder to consume considerable CPU and memory " +"resources. Limiting the size of data to be parsed is recommended." +msgstr "" + +#: ../../library/tomllib.rst:29 +msgid "" "The :pypi:`Tomli-W package ` is a TOML writer that can be used in " "conjunction with this module, providing a write API familiar to users of the " "standard library :mod:`marshal` and :mod:`pickle` modules." @@ -45,7 +52,7 @@ msgstr "" "提供標準函式庫中 :mod:`marshal` 和 :mod:`pickle` 模組之使用者所熟悉的寫入 " "API。" -#: ../../library/tomllib.rst:29 +#: ../../library/tomllib.rst:36 msgid "" "The :pypi:`TOML Kit package ` is a style-preserving TOML library " "with both read and write capability. It is a recommended replacement for " @@ -54,38 +61,38 @@ msgstr "" ":pypi:`TOML 工具套件 `\\ 是一個保留風格且具有讀寫能力的 TOML 函式" "庫。若要編輯已存在的 TOML 文件,建議用它來替換此模組。" -#: ../../library/tomllib.rst:35 +#: ../../library/tomllib.rst:42 msgid "This module defines the following functions:" msgstr "此模組定義了以下函式:" -#: ../../library/tomllib.rst:39 +#: ../../library/tomllib.rst:46 msgid "" "Read a TOML file. The first argument should be a readable and binary file " -"object. Return a :class:`dict`. Convert TOML types to Python using " -"this :ref:`conversion table `." +"object. Return a :class:`dict`. Convert TOML types to Python using this :ref:" +"`conversion table `." msgstr "" -"讀取一個 TOML 檔案。第一個引數應為一個可讀取的二進位檔案物件。回傳一" -"個 :class:`dict`。用這個\\ :ref:`轉換表 `\\ 將 TOML 型別轉" -"換成 Python 的。" +"讀取一個 TOML 檔案。第一個引數應為一個可讀取的二進位檔案物件。回傳一個 :" +"class:`dict`。用這個\\ :ref:`轉換表 `\\ 將 TOML 型別轉換成 " +"Python 的。" -#: ../../library/tomllib.rst:43 +#: ../../library/tomllib.rst:50 msgid "" "*parse_float* will be called with the string of every TOML float to be " "decoded. By default, this is equivalent to ``float(num_str)``. This can be " -"used to use another datatype or parser for TOML floats " -"(e.g. :class:`decimal.Decimal`). The callable must not return " -"a :class:`dict` or a :class:`list`, else a :exc:`ValueError` is raised." +"used to use another datatype or parser for TOML floats (e.g. :class:`decimal." +"Decimal`). The callable must not return a :class:`dict` or a :class:`list`, " +"else a :exc:`ValueError` is raised." msgstr "" "*parse_float* 會被呼叫於要解碼的每個 TOML 浮點數字串。預設情況下,這相當於 " -"``float(num_str)``。若有使用另一種資料型別或剖析器的 TOML 浮點數(例" -"如 :class:`decimal.Decimal`),這就派得上用場。可呼叫物件不得回" -"傳 :class:`dict` 或 :class:`list`,否則會引發 :exc:`ValueError`。" +"``float(num_str)``。若有使用另一種資料型別或剖析器的 TOML 浮點數(例如 :" +"class:`decimal.Decimal`),這就派得上用場。可呼叫物件不得回傳 :class:`dict` " +"或 :class:`list`,否則會引發 :exc:`ValueError`。" -#: ../../library/tomllib.rst:49 ../../library/tomllib.rst:58 +#: ../../library/tomllib.rst:56 ../../library/tomllib.rst:65 msgid "A :exc:`TOMLDecodeError` will be raised on an invalid TOML document." msgstr "不合格的 TOML 文件會使得 :exc:`TOMLDecodeError` 被引發。" -#: ../../library/tomllib.rst:54 +#: ../../library/tomllib.rst:61 msgid "" "Load TOML from a :class:`str` object. Return a :class:`dict`. Convert TOML " "types to Python using this :ref:`conversion table `. The " @@ -95,54 +102,53 @@ msgstr "" "轉換表 `\\ 轉換 TOML 型別成 Python 的。*parse_float* 引數" "和 :func:`load` 中的相同。" -#: ../../library/tomllib.rst:61 +#: ../../library/tomllib.rst:68 msgid "The following exceptions are available:" msgstr "以下為可用的例外:" -#: ../../library/tomllib.rst:65 +#: ../../library/tomllib.rst:72 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr "" -#: ../../library/tomllib.rst:69 +#: ../../library/tomllib.rst:76 msgid "The unformatted error message." msgstr "" -#: ../../library/tomllib.rst:73 +#: ../../library/tomllib.rst:80 msgid "The TOML document being parsed." msgstr "" -#: ../../library/tomllib.rst:77 +#: ../../library/tomllib.rst:84 msgid "The index of *doc* where parsing failed." msgstr "" -#: ../../library/tomllib.rst:81 +#: ../../library/tomllib.rst:88 msgid "The line corresponding to *pos*." msgstr "" -#: ../../library/tomllib.rst:85 +#: ../../library/tomllib.rst:92 msgid "The column corresponding to *pos*." msgstr "" -#: ../../library/tomllib.rst:87 +#: ../../library/tomllib.rst:94 msgid "" -"Added the *msg*, *doc* and *pos* parameters. Added " -"the :attr:`msg`, :attr:`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` " -"attributes." +"Added the *msg*, *doc* and *pos* parameters. Added the :attr:`msg`, :attr:" +"`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` attributes." msgstr "" -#: ../../library/tomllib.rst:91 +#: ../../library/tomllib.rst:98 msgid "Passing free-form positional arguments is deprecated." msgstr "傳遞自由形式的位置引數已被棄用。" -#: ../../library/tomllib.rst:96 +#: ../../library/tomllib.rst:103 msgid "Examples" msgstr "範例" -#: ../../library/tomllib.rst:98 +#: ../../library/tomllib.rst:105 msgid "Parsing a TOML file::" msgstr "剖析一個 TOML 檔案: ::" -#: ../../library/tomllib.rst:100 +#: ../../library/tomllib.rst:107 msgid "" "import tomllib\n" "\n" @@ -154,11 +160,11 @@ msgstr "" "with open(\"pyproject.toml\", \"rb\") as f:\n" " data = tomllib.load(f)" -#: ../../library/tomllib.rst:105 +#: ../../library/tomllib.rst:112 msgid "Parsing a TOML string::" msgstr "剖析一個 TOML 字串: ::" -#: ../../library/tomllib.rst:107 +#: ../../library/tomllib.rst:114 msgid "" "import tomllib\n" "\n" @@ -178,114 +184,114 @@ msgstr "" "\n" "data = tomllib.loads(toml_str)" -#: ../../library/tomllib.rst:118 +#: ../../library/tomllib.rst:125 msgid "Conversion Table" msgstr "轉換表" -#: ../../library/tomllib.rst:123 +#: ../../library/tomllib.rst:130 msgid "TOML" msgstr "TOML" -#: ../../library/tomllib.rst:123 +#: ../../library/tomllib.rst:130 msgid "Python" msgstr "Python" -#: ../../library/tomllib.rst:125 +#: ../../library/tomllib.rst:132 msgid "TOML document" msgstr "TOML 文件" -#: ../../library/tomllib.rst:125 ../../library/tomllib.rst:145 -#: ../../library/tomllib.rst:147 +#: ../../library/tomllib.rst:132 ../../library/tomllib.rst:152 +#: ../../library/tomllib.rst:154 msgid "dict" msgstr "dict" -#: ../../library/tomllib.rst:127 +#: ../../library/tomllib.rst:134 msgid "string" msgstr "string" -#: ../../library/tomllib.rst:127 +#: ../../library/tomllib.rst:134 msgid "str" msgstr "str" -#: ../../library/tomllib.rst:129 +#: ../../library/tomllib.rst:136 msgid "integer" msgstr "integer" -#: ../../library/tomllib.rst:129 +#: ../../library/tomllib.rst:136 msgid "int" msgstr "int" -#: ../../library/tomllib.rst:131 +#: ../../library/tomllib.rst:138 msgid "float" msgstr "float" -#: ../../library/tomllib.rst:131 +#: ../../library/tomllib.rst:138 msgid "float (configurable with *parse_float*)" msgstr "float(可透過 *parse_float* 調整)" -#: ../../library/tomllib.rst:133 +#: ../../library/tomllib.rst:140 msgid "boolean" msgstr "boolean" -#: ../../library/tomllib.rst:133 +#: ../../library/tomllib.rst:140 msgid "bool" msgstr "bool" -#: ../../library/tomllib.rst:135 +#: ../../library/tomllib.rst:142 msgid "offset date-time" msgstr "偏移日期時間 (offset date-time)" -#: ../../library/tomllib.rst:135 +#: ../../library/tomllib.rst:142 msgid "" -"datetime.datetime (``tzinfo`` attribute set to an instance of " -"``datetime.timezone``)" +"datetime.datetime (``tzinfo`` attribute set to an instance of ``datetime." +"timezone``)" msgstr "" "datetime.datetime(設定 ``tzinfo`` 屬性為 ``datetime.timezone`` 的實例)" -#: ../../library/tomllib.rst:137 +#: ../../library/tomllib.rst:144 msgid "local date-time" msgstr "本地日期時間 (local date-time)" -#: ../../library/tomllib.rst:137 +#: ../../library/tomllib.rst:144 msgid "datetime.datetime (``tzinfo`` attribute set to ``None``)" msgstr "datetime.datetime(設定 ``tzinfo`` 為 ``None``)" -#: ../../library/tomllib.rst:139 +#: ../../library/tomllib.rst:146 msgid "local date" msgstr "本地日期 (local date)" -#: ../../library/tomllib.rst:139 +#: ../../library/tomllib.rst:146 msgid "datetime.date" msgstr "datetime.date" -#: ../../library/tomllib.rst:141 +#: ../../library/tomllib.rst:148 msgid "local time" msgstr "本地時間 (local time)" -#: ../../library/tomllib.rst:141 +#: ../../library/tomllib.rst:148 msgid "datetime.time" msgstr "datetime.time" -#: ../../library/tomllib.rst:143 +#: ../../library/tomllib.rst:150 msgid "array" msgstr "array" -#: ../../library/tomllib.rst:143 +#: ../../library/tomllib.rst:150 msgid "list" msgstr "list" -#: ../../library/tomllib.rst:145 +#: ../../library/tomllib.rst:152 msgid "table" msgstr "table" -#: ../../library/tomllib.rst:147 +#: ../../library/tomllib.rst:154 msgid "inline table" msgstr "行內表格 (inline table)" -#: ../../library/tomllib.rst:149 +#: ../../library/tomllib.rst:156 msgid "array of tables" msgstr "表格陣列 (array of tables)" -#: ../../library/tomllib.rst:149 +#: ../../library/tomllib.rst:156 msgid "list of dicts" msgstr "dict 串列 (list of dicts)" diff --git a/library/typing.po b/library/typing.po index 08b1e84550..668f104ff8 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-26 18:22+0000\n" +"POT-Creation-Date: 2026-04-24 00:29+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -389,8 +389,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3296 -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:215 ../../library/typing.rst:3297 +#: ../../library/typing.rst:3498 msgid "For example:" msgstr "舉例來說:" @@ -513,7 +513,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:287 ../../library/typing.rst:4025 +#: ../../library/typing.rst:287 ../../library/typing.rst:4029 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -1578,10 +1578,10 @@ msgstr "" "不可以將此兩種混合。" #: ../../library/typing.rst:873 ../../library/typing.rst:991 -#: ../../library/typing.rst:1048 ../../library/typing.rst:1230 -#: ../../library/typing.rst:1317 ../../library/typing.rst:1359 -#: ../../library/typing.rst:1568 ../../library/typing.rst:1629 -#: ../../library/typing.rst:3233 ../../library/typing.rst:3479 +#: ../../library/typing.rst:1048 ../../library/typing.rst:1231 +#: ../../library/typing.rst:1318 ../../library/typing.rst:1360 +#: ../../library/typing.rst:1569 ../../library/typing.rst:1630 +#: ../../library/typing.rst:3234 ../../library/typing.rst:3483 msgid "For example::" msgstr "舉例來說: ::" @@ -1648,7 +1648,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:917 ../../library/typing.rst:2250 +#: ../../library/typing.rst:917 ../../library/typing.rst:2251 msgid "Example:" msgstr "舉例來說: ::" @@ -1983,7 +1983,7 @@ msgstr "單一引數的聯集會消失不見,舉例來說: ::" msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # 實際上建構函式會回傳 int" -#: ../../library/typing.rst:1116 ../../library/typing.rst:1260 +#: ../../library/typing.rst:1116 ../../library/typing.rst:1261 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" @@ -2085,19 +2085,20 @@ msgid "" "callables>` and :class:`ParamSpec` to annotate a higher-order callable which " "adds, removes, or transforms parameters of another callable. Usage is in " "the form ``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``. " -"``Concatenate`` is currently only valid when used as the first argument to " -"a :ref:`Callable `. The last parameter to " -"``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." -msgstr "" -"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" -"class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" -"增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " +"``Concatenate`` is valid when used in :ref:`Callable ` " +"type hints and when instantiating user-defined generic classes with :class:" +"`ParamSpec` parameters. The last parameter to ``Concatenate`` must be a :" +"class:`ParamSpec` or ellipsis (``...``)." +msgstr "" +"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與" +" :class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以" +"新增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` " -"目前只在 :ref:`Callable 物件 `\\ 中第一個引數使用時有" -"效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " -"(``...``)。" +"可用於 :ref:`Callable ` 型別提示中,也可在使用 :" +"class:`ParamSpec` 參數實例化使用者自訂泛型類別時使用。``Concatenate`` 的最後" +"一個參數必須為一個 :class:`ParamSpec` 或是刪節號 (``...``)。" -#: ../../library/typing.rst:1181 +#: ../../library/typing.rst:1182 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -2113,7 +2114,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1189 +#: ../../library/typing.rst:1190 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -2141,32 +2142,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1217 ../../library/typing.rst:2218 +#: ../../library/typing.rst:1218 ../../library/typing.rst:2219 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1219 +#: ../../library/typing.rst:1220 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1220 ../../library/typing.rst:2221 +#: ../../library/typing.rst:1221 ../../library/typing.rst:2222 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1224 +#: ../../library/typing.rst:1225 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1226 +#: ../../library/typing.rst:1227 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1232 +#: ../../library/typing.rst:1233 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -2188,7 +2189,7 @@ msgstr "" "open_helper('/some/path', 'r') # 通過型別檢查\n" "open_helper('/other/path', 'typo') # 型別檢查器中的錯誤" -#: ../../library/typing.rst:1242 +#: ../../library/typing.rst:1243 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -2198,29 +2199,29 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1246 +#: ../../library/typing.rst:1247 msgid "Additional details:" msgstr "其他細節:" -#: ../../library/typing.rst:1248 +#: ../../library/typing.rst:1249 msgid "The arguments must be literal values and there must be at least one." msgstr "引數必須為文本值且必須有至少一個。" -#: ../../library/typing.rst:1250 +#: ../../library/typing.rst:1251 msgid "Nested ``Literal`` types are flattened, e.g.::" msgstr "巢狀的 ``Literal`` 會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1252 +#: ../../library/typing.rst:1253 msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -#: ../../library/typing.rst:1254 +#: ../../library/typing.rst:1255 msgid "" "However, this does not apply to ``Literal`` types referenced through a type " "alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1257 +#: ../../library/typing.rst:1258 msgid "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" @@ -2228,27 +2229,27 @@ msgstr "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" -#: ../../library/typing.rst:1262 +#: ../../library/typing.rst:1263 msgid "assert Literal[1, 2, 1] == Literal[1, 2]" msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" -#: ../../library/typing.rst:1264 +#: ../../library/typing.rst:1265 msgid "When comparing literals, the argument order is ignored, e.g.::" msgstr "當比較文本時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1266 +#: ../../library/typing.rst:1267 msgid "assert Literal[1, 2] == Literal[2, 1]" msgstr "assert Literal[1, 2] == Literal[2, 1]" -#: ../../library/typing.rst:1268 +#: ../../library/typing.rst:1269 msgid "You cannot subclass or instantiate a ``Literal``." msgstr "你不能建立 ``Literal`` 的子類別或是實例。" -#: ../../library/typing.rst:1270 +#: ../../library/typing.rst:1271 msgid "You cannot write ``Literal[X][Y]``." msgstr "你不能寫成 ``Literal[X][Y]``。" -#: ../../library/typing.rst:1274 +#: ../../library/typing.rst:1275 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -2259,11 +2260,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1282 +#: ../../library/typing.rst:1283 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1284 +#: ../../library/typing.rst:1285 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -2273,7 +2274,7 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1288 +#: ../../library/typing.rst:1289 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" @@ -2283,11 +2284,11 @@ msgstr "" " stats: ClassVar[dict[str, int]] = {} # 類別變數\n" " damage: int = 10 # 實例變數" -#: ../../library/typing.rst:1292 +#: ../../library/typing.rst:1293 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1294 +#: ../../library/typing.rst:1295 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -2299,22 +2300,22 @@ msgstr "" "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" "式碼為一個錯誤: ::" -#: ../../library/typing.rst:1300 +#: ../../library/typing.rst:1301 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1308 +#: ../../library/typing.rst:1309 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" -#: ../../library/typing.rst:1312 +#: ../../library/typing.rst:1313 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1314 +#: ../../library/typing.rst:1315 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2322,7 +2323,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1319 +#: ../../library/typing.rst:1320 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2334,22 +2335,22 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1328 ../../library/typing.rst:3249 +#: ../../library/typing.rst:1329 ../../library/typing.rst:3250 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1335 +#: ../../library/typing.rst:1336 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" -#: ../../library/typing.rst:1339 +#: ../../library/typing.rst:1340 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1342 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -2357,23 +2358,23 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1348 +#: ../../library/typing.rst:1349 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1351 +#: ../../library/typing.rst:1352 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1357 +#: ../../library/typing.rst:1358 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" -#: ../../library/typing.rst:1361 +#: ../../library/typing.rst:1362 msgid "" "class Movie(TypedDict):\n" " title: ReadOnly[str]\n" @@ -2391,19 +2392,19 @@ msgstr "" " m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # 型別檢查器錯誤" -#: ../../library/typing.rst:1369 +#: ../../library/typing.rst:1370 msgid "There is no runtime checking for this property." msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" -#: ../../library/typing.rst:1371 +#: ../../library/typing.rst:1372 msgid "See :class:`TypedDict` and :pep:`705` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" -#: ../../library/typing.rst:1377 +#: ../../library/typing.rst:1378 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1379 +#: ../../library/typing.rst:1380 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2411,7 +2412,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1384 +#: ../../library/typing.rst:1385 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2420,7 +2421,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1390 +#: ../../library/typing.rst:1391 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2430,7 +2431,7 @@ msgid "" "class." msgstr "" -#: ../../library/typing.rst:1397 +#: ../../library/typing.rst:1398 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2438,13 +2439,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1405 +#: ../../library/typing.rst:1406 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1408 +#: ../../library/typing.rst:1409 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2462,14 +2463,14 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1418 +#: ../../library/typing.rst:1419 msgid "" "The first argument to ``Annotated`` must be a valid type. Multiple metadata " "elements can be supplied as ``Annotated`` supports variadic arguments. The " "order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: ../../library/typing.rst:1422 +#: ../../library/typing.rst:1423 msgid "" "@dataclass\n" "class ctype:\n" @@ -2489,20 +2490,20 @@ msgstr "" "\n" "assert a1 != a2 # 順序是有意義的" -#: ../../library/typing.rst:1431 +#: ../../library/typing.rst:1432 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1435 +#: ../../library/typing.rst:1436 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1438 +#: ../../library/typing.rst:1439 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2514,14 +2515,14 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1442 +#: ../../library/typing.rst:1443 msgid "" "However, this does not apply to ``Annotated`` types referenced through a " "type alias, to avoid forcing evaluation of the underlying :class:" "`TypeAliasType`::" msgstr "" -#: ../../library/typing.rst:1445 +#: ../../library/typing.rst:1446 msgid "" "type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" "assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" @@ -2533,11 +2534,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1450 +#: ../../library/typing.rst:1451 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1453 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2547,11 +2548,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1456 +#: ../../library/typing.rst:1457 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1458 +#: ../../library/typing.rst:1459 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2565,11 +2566,11 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1470 +#: ../../library/typing.rst:1471 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1472 +#: ../../library/typing.rst:1473 msgid "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # NOT valid" @@ -2577,19 +2578,19 @@ msgstr "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # 無效" -#: ../../library/typing.rst:1474 +#: ../../library/typing.rst:1475 msgid "" "where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " "as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1477 +#: ../../library/typing.rst:1478 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1481 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2607,13 +2608,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1491 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1494 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2629,13 +2630,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1502 +#: ../../library/typing.rst:1503 msgid "" "If you want to retrieve the original type wrapped by ``Annotated``, use the :" "attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1506 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2647,11 +2648,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1513 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1514 +#: ../../library/typing.rst:1515 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2659,20 +2660,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1521 +#: ../../library/typing.rst:1522 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1523 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1529 ../../library/typing.rst:1613 +#: ../../library/typing.rst:1530 ../../library/typing.rst:1614 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1531 +#: ../../library/typing.rst:1532 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2680,7 +2681,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1536 +#: ../../library/typing.rst:1537 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2690,7 +2691,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1542 +#: ../../library/typing.rst:1543 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2702,7 +2703,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1551 +#: ../../library/typing.rst:1552 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type predicate. Such a function should use ``TypeIs[...]`` or :data:" @@ -2713,29 +2714,29 @@ msgid "" "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1560 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1562 ../../library/typing.rst:1623 +#: ../../library/typing.rst:1563 ../../library/typing.rst:1624 msgid "The return value is a boolean." msgstr "回傳值是一個布林值。" -#: ../../library/typing.rst:1563 +#: ../../library/typing.rst:1564 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1565 +#: ../../library/typing.rst:1566 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1570 +#: ../../library/typing.rst:1571 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2759,7 +2760,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1591 +#: ../../library/typing.rst:1592 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2768,27 +2769,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1597 +#: ../../library/typing.rst:1598 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1601 +#: ../../library/typing.rst:1602 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1605 +#: ../../library/typing.rst:1606 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1615 +#: ../../library/typing.rst:1616 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2796,25 +2797,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1620 +#: ../../library/typing.rst:1621 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1624 +#: ../../library/typing.rst:1625 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1628 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1631 +#: ../../library/typing.rst:1632 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2829,11 +2830,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1644 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "``TypeIs`` 和 ``TypeGuard`` 在以下幾個方面有所不同:" -#: ../../library/typing.rst:1645 +#: ../../library/typing.rst:1646 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2841,7 +2842,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1650 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2850,7 +2851,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1653 +#: ../../library/typing.rst:1654 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2858,18 +2859,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1662 +#: ../../library/typing.rst:1663 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1665 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1668 +#: ../../library/typing.rst:1669 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2877,7 +2878,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1673 +#: ../../library/typing.rst:1674 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2885,7 +2886,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1680 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2896,13 +2897,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1688 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1690 +#: ../../library/typing.rst:1691 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2915,23 +2916,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1700 +#: ../../library/typing.rst:1701 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1705 +#: ../../library/typing.rst:1706 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1708 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1711 +#: ../../library/typing.rst:1712 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2939,17 +2940,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1718 +#: ../../library/typing.rst:1719 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1720 +#: ../../library/typing.rst:1721 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1723 +#: ../../library/typing.rst:1724 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2961,17 +2962,17 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1728 +#: ../../library/typing.rst:1729 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1733 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1735 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2985,20 +2986,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1740 +#: ../../library/typing.rst:1741 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1743 +#: ../../library/typing.rst:1744 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1749 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -3016,18 +3017,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1760 +#: ../../library/typing.rst:1761 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1762 +#: ../../library/typing.rst:1763 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1767 +#: ../../library/typing.rst:1768 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -3035,13 +3036,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1770 +#: ../../library/typing.rst:1771 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1773 +#: ../../library/typing.rst:1774 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -3052,13 +3053,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1780 +#: ../../library/typing.rst:1781 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1782 +#: ../../library/typing.rst:1783 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" @@ -3068,7 +3069,7 @@ msgstr "" "S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" "A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1786 +#: ../../library/typing.rst:1787 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -3076,7 +3077,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1793 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -3094,13 +3095,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1808 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1810 +#: ../../library/typing.rst:1811 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -3110,14 +3111,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1818 +#: ../../library/typing.rst:1819 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1822 +#: ../../library/typing.rst:1823 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -3131,13 +3132,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1834 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1836 +#: ../../library/typing.rst:1837 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -3148,13 +3149,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1845 +#: ../../library/typing.rst:1846 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1848 +#: ../../library/typing.rst:1849 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -3167,39 +3168,39 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1857 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1860 +#: ../../library/typing.rst:1861 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1865 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:1869 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1872 +#: ../../library/typing.rst:1873 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1878 +#: ../../library/typing.rst:1879 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1882 +#: ../../library/typing.rst:1883 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:1889 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " "attribute. When called directly, this method supports only the :attr:" @@ -3209,18 +3210,18 @@ msgid "" "in a different format." msgstr "" -#: ../../library/typing.rst:1898 +#: ../../library/typing.rst:1899 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1903 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1908 +#: ../../library/typing.rst:1909 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__constraints__` attribute. When called directly, this method supports only " @@ -3230,13 +3231,13 @@ msgid "" "to evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:1918 +#: ../../library/typing.rst:1919 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:1926 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__default__` attribute. When called directly, this method supports only the :" @@ -3246,7 +3247,7 @@ msgid "" "the value in a different format." msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:1936 msgid "" "Return whether or not the type variable has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3254,31 +3255,31 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1944 +#: ../../library/typing.rst:1945 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1950 ../../library/typing.rst:2099 -#: ../../library/typing.rst:2211 +#: ../../library/typing.rst:1951 ../../library/typing.rst:2100 +#: ../../library/typing.rst:2212 msgid "Support for default values was added." msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1956 +#: ../../library/typing.rst:1957 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1959 +#: ../../library/typing.rst:1960 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1962 +#: ../../library/typing.rst:1963 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3288,11 +3289,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1965 +#: ../../library/typing.rst:1966 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1967 +#: ../../library/typing.rst:1968 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3306,7 +3307,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1974 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3314,7 +3315,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1978 +#: ../../library/typing.rst:1979 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3334,7 +3335,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:1996 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3344,13 +3345,13 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:2003 +#: ../../library/typing.rst:2004 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:2006 +#: ../../library/typing.rst:2007 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" @@ -3360,13 +3361,13 @@ msgstr "" "x: tuple[Ts] # 無效\n" "x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:2010 +#: ../../library/typing.rst:2011 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2014 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3378,12 +3379,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:2018 +#: ../../library/typing.rst:2019 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:2020 +#: ../../library/typing.rst:2021 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3398,13 +3399,13 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:2034 +#: ../../library/typing.rst:2035 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:2037 +#: ../../library/typing.rst:2038 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" @@ -3414,13 +3415,13 @@ msgstr "" "class Array[*Shape, *Shape]: # 無效\n" " pass" -#: ../../library/typing.rst:2041 +#: ../../library/typing.rst:2042 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:2044 +#: ../../library/typing.rst:2045 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3436,7 +3437,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:2051 +#: ../../library/typing.rst:2052 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3445,21 +3446,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2059 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2063 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2067 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2073 +#: ../../library/typing.rst:2074 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVarTuple." "__default__` attribute. When called directly, this method supports only the :" @@ -3469,7 +3470,7 @@ msgid "" "evaluate the value in a different format." msgstr "" -#: ../../library/typing.rst:2083 +#: ../../library/typing.rst:2084 msgid "" "Return whether or not the type variable tuple has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." @@ -3477,39 +3478,39 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2094 +#: ../../library/typing.rst:2095 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2103 +#: ../../library/typing.rst:2104 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2106 +#: ../../library/typing.rst:2107 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2110 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2111 +#: ../../library/typing.rst:2112 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2114 +#: ../../library/typing.rst:2115 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2117 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3519,7 +3520,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2124 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3527,7 +3528,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2128 +#: ../../library/typing.rst:2129 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3545,27 +3546,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2144 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2147 +#: ../../library/typing.rst:2148 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2150 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2157 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3578,17 +3579,17 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2168 +#: ../../library/typing.rst:2169 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2173 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2179 +#: ../../library/typing.rst:2180 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~ParamSpec." "__default__` attribute. When called directly, this method supports only the :" @@ -3598,7 +3599,7 @@ msgid "" "the value in a different format." msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2190 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" @@ -3606,7 +3607,7 @@ msgid "" "the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2196 +#: ../../library/typing.rst:2197 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3615,23 +3616,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:2206 +#: ../../library/typing.rst:2207 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2214 +#: ../../library/typing.rst:2215 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2220 +#: ../../library/typing.rst:2221 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2226 +#: ../../library/typing.rst:2227 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3639,13 +3640,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2231 +#: ../../library/typing.rst:2232 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2234 +#: ../../library/typing.rst:2235 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3661,11 +3662,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2248 +#: ../../library/typing.rst:2249 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2253 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3675,11 +3676,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2262 +#: ../../library/typing.rst:2263 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2264 +#: ../../library/typing.rst:2265 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3689,11 +3690,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2272 +#: ../../library/typing.rst:2273 msgid "The name of the module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2275 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3703,13 +3704,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2280 +#: ../../library/typing.rst:2281 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2283 +#: ../../library/typing.rst:2284 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3725,14 +3726,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2294 +#: ../../library/typing.rst:2295 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2298 +#: ../../library/typing.rst:2299 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3756,7 +3757,7 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2313 +#: ../../library/typing.rst:2314 msgid "" "An :term:`evaluate function` corresponding to the :attr:`__value__` " "attribute. When called directly, this method supports only the :attr:" @@ -3766,7 +3767,7 @@ msgid "" "different format:" msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2320 msgid "" ">>> type Alias = undefined\n" ">>> Alias.__value__\n" @@ -3794,17 +3795,17 @@ msgstr "" ">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" "ForwardRef('undefined')" -#: ../../library/typing.rst:2337 +#: ../../library/typing.rst:2338 msgid "Unpacking" msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2339 msgid "" "Type aliases support star unpacking using the ``*Alias`` syntax. This is " "equivalent to using ``Unpack[Alias]`` directly:" msgstr "" -#: ../../library/typing.rst:2341 +#: ../../library/typing.rst:2342 msgid "" ">>> type Alias = tuple[int, str]\n" ">>> type Unpacked = tuple[bool, *Alias]\n" @@ -3816,27 +3817,27 @@ msgstr "" ">>> Unpacked.__value__\n" "tuple[bool, typing.Unpack[Alias]]" -#: ../../library/typing.rst:2352 +#: ../../library/typing.rst:2353 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2354 +#: ../../library/typing.rst:2355 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2360 +#: ../../library/typing.rst:2361 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2362 ../../library/typing.rst:2462 -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:2363 ../../library/typing.rst:2463 +#: ../../library/typing.rst:3587 msgid "Usage::" msgstr "用法: ::" -#: ../../library/typing.rst:2364 +#: ../../library/typing.rst:2365 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3846,20 +3847,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2368 +#: ../../library/typing.rst:2369 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2370 +#: ../../library/typing.rst:2371 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2373 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2375 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3875,12 +3876,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2382 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2383 +#: ../../library/typing.rst:2384 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3889,11 +3890,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2389 +#: ../../library/typing.rst:2390 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2391 +#: ../../library/typing.rst:2392 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3904,11 +3905,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2399 +#: ../../library/typing.rst:2400 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2401 +#: ../../library/typing.rst:2402 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3918,11 +3919,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2405 +#: ../../library/typing.rst:2406 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2407 +#: ../../library/typing.rst:2408 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3935,51 +3936,51 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2417 +#: ../../library/typing.rst:2418 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2420 +#: ../../library/typing.rst:2421 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2423 +#: ../../library/typing.rst:2424 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2427 +#: ../../library/typing.rst:2428 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2431 +#: ../../library/typing.rst:2432 msgid "" "``NamedTuple`` is now a function rather than a class. It can still be used " "as a class base, as described above." msgstr "" -#: ../../library/typing.rst:2435 +#: ../../library/typing.rst:2436 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2438 +#: ../../library/typing.rst:2439 msgid "" "Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " "methods of ``NamedTuple`` subclasses is unsupported and causes a :class:" "`TypeError`." msgstr "" -#: ../../library/typing.rst:2442 +#: ../../library/typing.rst:2443 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2447 +#: ../../library/typing.rst:2448 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3989,48 +3990,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2458 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2459 +#: ../../library/typing.rst:2460 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2464 +#: ../../library/typing.rst:2465 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2469 +#: ../../library/typing.rst:2470 msgid "The name of the module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2473 +#: ../../library/typing.rst:2474 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2477 +#: ../../library/typing.rst:2478 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2481 +#: ../../library/typing.rst:2482 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2487 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2489 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2490 +#: ../../library/typing.rst:2491 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -4040,13 +4041,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2494 +#: ../../library/typing.rst:2495 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2497 +#: ../../library/typing.rst:2498 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -4058,7 +4059,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2506 +#: ../../library/typing.rst:2507 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -4067,11 +4068,11 @@ msgid "" "second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2513 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2514 +#: ../../library/typing.rst:2515 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -4081,13 +4082,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2518 +#: ../../library/typing.rst:2519 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2521 +#: ../../library/typing.rst:2522 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4101,11 +4102,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2532 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2533 +#: ../../library/typing.rst:2534 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This allows a simple-minded structural check, very similar to \"one trick " @@ -4113,7 +4114,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2537 +#: ../../library/typing.rst:2538 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -4141,12 +4142,12 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2551 msgid "" "This decorator raises :exc:`TypeError` when applied to a non-protocol class." msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2555 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -4157,7 +4158,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2565 +#: ../../library/typing.rst:2566 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -4165,7 +4166,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2573 +#: ../../library/typing.rst:2574 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -4175,7 +4176,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2582 +#: ../../library/typing.rst:2583 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -4184,13 +4185,13 @@ msgid "" "`What's new in Python 3.12 ` for more details." msgstr "" -#: ../../library/typing.rst:2593 +#: ../../library/typing.rst:2594 msgid "" "Special construct to add type hints to a dictionary. At runtime \":class:`!" "TypedDict` instances\" are simply :class:`dicts `." msgstr "" -#: ../../library/typing.rst:2596 +#: ../../library/typing.rst:2597 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -4198,7 +4199,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2602 +#: ../../library/typing.rst:2603 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4211,17 +4212,17 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2612 +#: ../../library/typing.rst:2613 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2615 +#: ../../library/typing.rst:2616 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2618 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " @@ -4229,7 +4230,7 @@ msgid "" "mangling>` like regular private names::" msgstr "" -#: ../../library/typing.rst:2622 +#: ../../library/typing.rst:2623 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -4244,13 +4245,13 @@ msgid "" "Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2634 +#: ../../library/typing.rst:2635 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2637 +#: ../../library/typing.rst:2638 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -4270,19 +4271,19 @@ msgstr "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" -#: ../../library/typing.rst:2645 +#: ../../library/typing.rst:2646 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2648 +#: ../../library/typing.rst:2649 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2651 +#: ../../library/typing.rst:2652 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -4298,7 +4299,7 @@ msgstr "" "# 替代語法\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2658 +#: ../../library/typing.rst:2659 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -4306,13 +4307,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2663 +#: ../../library/typing.rst:2664 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2666 +#: ../../library/typing.rst:2667 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -4338,13 +4339,13 @@ msgstr "" " 'label': str\n" "}, total=False)" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2679 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2682 +#: ../../library/typing.rst:2683 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -4352,13 +4353,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2685 +#: ../../library/typing.rst:2686 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2688 +#: ../../library/typing.rst:2689 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -4370,13 +4371,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2693 +#: ../../library/typing.rst:2694 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2696 +#: ../../library/typing.rst:2697 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -4402,11 +4403,11 @@ msgstr "" "\n" "class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2709 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2710 +#: ../../library/typing.rst:2711 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -4416,13 +4417,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2714 +#: ../../library/typing.rst:2715 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2718 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4436,19 +4437,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2725 +#: ../../library/typing.rst:2726 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2731 +#: ../../library/typing.rst:2732 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2734 +#: ../../library/typing.rst:2735 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4472,7 +4473,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2748 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4483,21 +4484,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2760 +#: ../../library/typing.rst:2761 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2764 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2766 +#: ../../library/typing.rst:2767 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4506,7 +4507,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2773 +#: ../../library/typing.rst:2774 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4532,7 +4533,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2791 +#: ../../library/typing.rst:2792 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4541,56 +4542,56 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:2798 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2801 +#: ../../library/typing.rst:2802 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2809 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2813 +#: ../../library/typing.rst:2814 msgid "" "See the `TypedDict `_ section in the typing documentation for more examples and " "detailed rules." msgstr "" -#: ../../library/typing.rst:2817 +#: ../../library/typing.rst:2818 msgid "" "``TypedDict`` is now a function rather than a class. It can still be used as " "a class base, as described above." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2822 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2825 +#: ../../library/typing.rst:2826 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2828 +#: ../../library/typing.rst:2829 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:2832 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2835 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4600,53 +4601,53 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2843 +#: ../../library/typing.rst:2844 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2845 +#: ../../library/typing.rst:2846 msgid "" "The following protocols are provided by the :mod:`!typing` module. All are " "decorated with :deco:`runtime_checkable`." msgstr "" -#: ../../library/typing.rst:2850 +#: ../../library/typing.rst:2851 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2855 +#: ../../library/typing.rst:2856 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2859 +#: ../../library/typing.rst:2860 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2864 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2868 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2873 +#: ../../library/typing.rst:2874 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:2878 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:2884 msgid "ABCs and Protocols for working with I/O" msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:2890 msgid "" "Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " @@ -4654,14 +4655,14 @@ msgid "" "interface is fairly broad." msgstr "" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2896 msgid "" "The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " "alternative for argument types, when only the ``read()`` or ``write()`` " "methods are accessed, respectively::" msgstr "" -#: ../../library/typing.rst:2899 +#: ../../library/typing.rst:2900 msgid "" "def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" " data = reader.read()\n" @@ -4671,13 +4672,13 @@ msgstr "" " data = reader.read()\n" " writer.write(data.encode())" -#: ../../library/typing.rst:2903 +#: ../../library/typing.rst:2904 msgid "" "Also consider using :class:`collections.abc.Iterable` for iterating over the " "lines of an input stream::" msgstr "" -#: ../../library/typing.rst:2906 +#: ../../library/typing.rst:2907 msgid "" "def read_config(stream: Iterable[str]):\n" " for line in stream:\n" @@ -4687,40 +4688,40 @@ msgstr "" " for line in stream:\n" " ..." -#: ../../library/typing.rst:2911 +#: ../../library/typing.rst:2912 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2915 +#: ../../library/typing.rst:2916 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2917 +#: ../../library/typing.rst:2918 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2924 +#: ../../library/typing.rst:2925 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2926 +#: ../../library/typing.rst:2927 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2929 +#: ../../library/typing.rst:2930 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2932 +#: ../../library/typing.rst:2933 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" @@ -4730,13 +4731,13 @@ msgstr "" " assert_type(name, str) # OK,推斷出的 `name` 型別是 `str`\n" " assert_type(name, int) # 型別檢查器錯誤" -#: ../../library/typing.rst:2936 +#: ../../library/typing.rst:2937 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2939 +#: ../../library/typing.rst:2940 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4746,16 +4747,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2950 +#: ../../library/typing.rst:2951 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2952 +#: ../../library/typing.rst:2953 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:2955 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4775,14 +4776,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2963 +#: ../../library/typing.rst:2964 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2968 +#: ../../library/typing.rst:2969 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4792,47 +4793,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2976 +#: ../../library/typing.rst:2977 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:2980 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " "checking with static typing." msgstr "" -#: ../../library/typing.rst:2987 +#: ../../library/typing.rst:2988 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2989 +#: ../../library/typing.rst:2990 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2992 +#: ../../library/typing.rst:2993 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2995 +#: ../../library/typing.rst:2996 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2998 +#: ../../library/typing.rst:2999 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:3002 +#: ../../library/typing.rst:3003 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4840,13 +4841,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:3005 +#: ../../library/typing.rst:3006 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3009 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4854,13 +4855,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:3019 +#: ../../library/typing.rst:3020 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:3022 +#: ../../library/typing.rst:3023 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4869,11 +4870,11 @@ msgid "" "to :deco:`dataclasses.dataclass`." msgstr "" -#: ../../library/typing.rst:3029 +#: ../../library/typing.rst:3030 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3032 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4895,11 +4896,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3043 +#: ../../library/typing.rst:3044 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:3045 +#: ../../library/typing.rst:3046 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4915,11 +4916,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3053 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:3054 +#: ../../library/typing.rst:3055 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4939,7 +4940,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:3063 +#: ../../library/typing.rst:3064 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :deco:`dataclasses.dataclass`. For " @@ -4947,7 +4948,7 @@ msgid "" "that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:3069 +#: ../../library/typing.rst:3070 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " @@ -4957,7 +4958,7 @@ msgid "" "``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:3077 +#: ../../library/typing.rst:3078 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4968,90 +4969,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:3081 +#: ../../library/typing.rst:3082 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3087 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3091 +#: ../../library/typing.rst:3092 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3096 +#: ../../library/typing.rst:3097 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:3097 +#: ../../library/typing.rst:3098 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: ../../library/typing.rst:3103 +#: ../../library/typing.rst:3104 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:3109 +#: ../../library/typing.rst:3110 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:3113 +#: ../../library/typing.rst:3114 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:3116 +#: ../../library/typing.rst:3117 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3121 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:3121 +#: ../../library/typing.rst:3122 msgid "Description" msgstr "" -#: ../../library/typing.rst:3122 +#: ../../library/typing.rst:3123 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3124 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:3126 +#: ../../library/typing.rst:3127 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:3127 +#: ../../library/typing.rst:3128 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:3128 +#: ../../library/typing.rst:3129 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3130 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -5059,19 +5060,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:3134 +#: ../../library/typing.rst:3135 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:3135 +#: ../../library/typing.rst:3136 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:3136 +#: ../../library/typing.rst:3137 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:3137 +#: ../../library/typing.rst:3138 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -5081,32 +5082,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:3143 +#: ../../library/typing.rst:3144 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3145 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3148 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: ../../library/typing.rst:3151 +#: ../../library/typing.rst:3152 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:3159 +#: ../../library/typing.rst:3160 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3162 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -5114,7 +5115,7 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3167 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " @@ -5124,13 +5125,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3175 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: ../../library/typing.rst:3177 +#: ../../library/typing.rst:3178 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -5156,22 +5157,22 @@ msgstr "" "def process(response):\n" " ... # 實際的實作在這邊" -#: ../../library/typing.rst:3191 +#: ../../library/typing.rst:3192 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3194 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:3200 +#: ../../library/typing.rst:3201 msgid "Return a sequence of :deco:`overload`-decorated definitions for *func*." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3204 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -5181,32 +5182,32 @@ msgid "" "sequence." msgstr "" -#: ../../library/typing.rst:3210 +#: ../../library/typing.rst:3211 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3219 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3221 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3227 +#: ../../library/typing.rst:3228 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3230 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3235 +#: ../../library/typing.rst:3236 msgid "" "class Base:\n" " @final\n" @@ -5236,7 +5237,7 @@ msgstr "" "class Other(Leaf): # 型別檢查器回報的錯誤\n" " ..." -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3255 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -5246,11 +5247,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3265 +#: ../../library/typing.rst:3266 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3267 +#: ../../library/typing.rst:3268 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -5258,40 +5259,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3273 +#: ../../library/typing.rst:3274 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3278 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3279 +#: ../../library/typing.rst:3280 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3282 +#: ../../library/typing.rst:3283 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3288 +#: ../../library/typing.rst:3289 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3291 +#: ../../library/typing.rst:3292 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3298 +#: ../../library/typing.rst:3299 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -5307,11 +5308,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3313 +#: ../../library/typing.rst:3314 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3315 +#: ../../library/typing.rst:3316 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -5321,22 +5322,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3322 +#: ../../library/typing.rst:3323 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3330 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3331 +#: ../../library/typing.rst:3332 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3335 +#: ../../library/typing.rst:3336 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -5346,29 +5347,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3342 +#: ../../library/typing.rst:3343 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3347 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3350 +#: ../../library/typing.rst:3351 msgid "" "Return a dictionary containing type hints for a function, method, module, " "class object, or other callable object." msgstr "" -#: ../../library/typing.rst:3353 +#: ../../library/typing.rst:3354 msgid "" -"This is often the same as ``obj.__annotations__``, but this function makes " -"the following changes to the annotations dictionary:" +"This is often the same as :func:`annotationlib.get_annotations`, but this " +"function makes the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3356 +#: ../../library/typing.rst:3357 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -5377,27 +5378,28 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3362 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3362 +#: ../../library/typing.rst:3363 msgid "" "If :deco:`no_type_check` has been applied to *obj*, an empty dictionary is " "returned." msgstr "" -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:3365 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " "done by traversing :attr:`C.__mro__ ` and iteratively " -"combining ``__annotations__`` dictionaries. Annotations on classes appearing " -"earlier in the :term:`method resolution order` always take precedence over " -"annotations on classes appearing later in the method resolution order." +"combining :term:`annotations ` of each base class. " +"Annotations on classes appearing earlier in the :term:`method resolution " +"order` always take precedence over annotations on classes appearing later in " +"the method resolution order." msgstr "" -#: ../../library/typing.rst:3371 +#: ../../library/typing.rst:3373 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]``, " "``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]`` with ``T``, unless " @@ -5405,25 +5407,20 @@ msgid "" "information)." msgstr "" -#: ../../library/typing.rst:3376 -msgid "" -"See also :func:`annotationlib.get_annotations`, a lower-level function that " -"returns annotations more directly." -msgstr "" - -#: ../../library/typing.rst:3381 ../../library/typing.rst:3544 +#: ../../library/typing.rst:3380 ../../library/typing.rst:3548 msgid "" "This function may execute arbitrary code contained in annotations. See :ref:" "`annotationlib-security` for more information." msgstr "" -#: ../../library/typing.rst:3386 +#: ../../library/typing.rst:3385 msgid "" -"If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " -"aliases ` that include forward references, or with names " -"imported under :data:`if TYPE_CHECKING `." +"If :attr:`Format.VALUE ` is used and any forward " +"references in the annotations of *obj* are not resolvable, a :exc:" +"`NameError` exception is raised. For example, this can happen with names " +"imported under :data:`if TYPE_CHECKING `. More generally, any " +"kind of exception can be raised if an annotation contains invalid Python " +"code." msgstr "" #: ../../library/typing.rst:3394 @@ -5450,18 +5447,26 @@ msgstr "" #: ../../library/typing.rst:3408 msgid "" +"Added the ``format`` parameter. See the documentation on :func:" +"`annotationlib.get_annotations` for more information." +msgstr "" +"新增 ``format`` 參數。更多資訊請見 :func:`annotationlib.get_annotations` 的" +"文件。" + +#: ../../library/typing.rst:3412 +msgid "" "Calling :func:`get_type_hints` on instances is no longer supported. Some " "instances were accepted in earlier versions as an undocumented " "implementation detail." msgstr "" -#: ../../library/typing.rst:3415 +#: ../../library/typing.rst:3419 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3418 +#: ../../library/typing.rst:3422 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -5469,11 +5474,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3424 ../../library/typing.rst:3448 +#: ../../library/typing.rst:3428 ../../library/typing.rst:3452 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3430 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -5491,13 +5496,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3440 +#: ../../library/typing.rst:3444 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3443 +#: ../../library/typing.rst:3447 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -5505,7 +5510,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3454 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5515,11 +5520,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3460 +#: ../../library/typing.rst:3464 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3462 +#: ../../library/typing.rst:3466 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5535,15 +5540,15 @@ msgstr "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3475 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3477 +#: ../../library/typing.rst:3481 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3481 +#: ../../library/typing.rst:3485 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5559,11 +5564,11 @@ msgstr "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" -#: ../../library/typing.rst:3492 +#: ../../library/typing.rst:3496 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3496 +#: ../../library/typing.rst:3500 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5577,57 +5582,57 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3513 +#: ../../library/typing.rst:3517 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3519 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3520 +#: ../../library/typing.rst:3524 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3526 +#: ../../library/typing.rst:3530 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" -#: ../../library/typing.rst:3533 +#: ../../library/typing.rst:3537 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3539 msgid "" "This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " "unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " "forward references nested within the type hint." msgstr "" -#: ../../library/typing.rst:3539 +#: ../../library/typing.rst:3543 msgid "" "See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " "meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " "parameters." msgstr "" -#: ../../library/typing.rst:3551 +#: ../../library/typing.rst:3555 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3558 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5643,17 +5648,17 @@ msgstr "" ">>> S.__default__ is None\n" "True" -#: ../../library/typing.rst:3566 +#: ../../library/typing.rst:3570 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3570 +#: ../../library/typing.rst:3574 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It's ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3573 +#: ../../library/typing.rst:3577 msgid "" "A module which is expensive to import, and which only contain types used for " "typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " @@ -5665,7 +5670,7 @@ msgid "" "will be checked properly during such analysis." msgstr "" -#: ../../library/typing.rst:3585 +#: ../../library/typing.rst:3589 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5679,7 +5684,7 @@ msgstr "" "def fun(arg: expensive_mod.SomeType) -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3591 +#: ../../library/typing.rst:3595 msgid "" "If you occasionally need to examine type annotations at runtime which may " "contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " @@ -5688,11 +5693,11 @@ msgid "" "raising :exc:`NameError`." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3608 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3610 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5701,7 +5706,7 @@ msgid "" "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3617 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5709,7 +5714,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3618 +#: ../../library/typing.rst:3622 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -5717,38 +5722,38 @@ msgid "" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3623 +#: ../../library/typing.rst:3627 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3629 +#: ../../library/typing.rst:3633 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3633 +#: ../../library/typing.rst:3637 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3639 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3639 +#: ../../library/typing.rst:3643 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3645 +#: ../../library/typing.rst:3649 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3647 +#: ../../library/typing.rst:3651 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5756,136 +5761,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3652 +#: ../../library/typing.rst:3656 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3662 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3660 +#: ../../library/typing.rst:3664 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3664 +#: ../../library/typing.rst:3668 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3674 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3672 +#: ../../library/typing.rst:3676 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3679 +#: ../../library/typing.rst:3683 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3681 +#: ../../library/typing.rst:3685 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3684 +#: ../../library/typing.rst:3688 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3690 +#: ../../library/typing.rst:3694 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3692 +#: ../../library/typing.rst:3696 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3697 +#: ../../library/typing.rst:3701 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3704 +#: ../../library/typing.rst:3708 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3708 +#: ../../library/typing.rst:3712 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3712 +#: ../../library/typing.rst:3716 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3718 +#: ../../library/typing.rst:3722 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3722 +#: ../../library/typing.rst:3726 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3732 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3732 +#: ../../library/typing.rst:3736 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3742 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3746 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3752 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3756 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3759 +#: ../../library/typing.rst:3763 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3764 +#: ../../library/typing.rst:3768 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3767 +#: ../../library/typing.rst:3771 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5893,29 +5898,29 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3772 +#: ../../library/typing.rst:3776 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3778 +#: ../../library/typing.rst:3782 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3780 +#: ../../library/typing.rst:3784 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3784 +#: ../../library/typing.rst:3788 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3787 +#: ../../library/typing.rst:3791 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" @@ -5923,32 +5928,32 @@ msgstr "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" -#: ../../library/typing.rst:3792 +#: ../../library/typing.rst:3796 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3802 +#: ../../library/typing.rst:3806 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3810 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3808 +#: ../../library/typing.rst:3812 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3818 msgid "Deprecated alias to :class:`collections.abc.ByteString`." msgstr "棄用 :class:`collections.abc.ByteString` 的別名。" -#: ../../library/typing.rst:3816 +#: ../../library/typing.rst:3820 msgid "" "Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " "implements the :ref:`buffer protocol ` at runtime. For use in " @@ -5961,7 +5966,7 @@ msgstr "" "用 :class:`~collections.abc.Buffer` 或明確指定你的程式碼所支援型別的聯集(例" "如 ``bytes | bytearray | memoryview``)。" -#: ../../library/typing.rst:3822 +#: ../../library/typing.rst:3826 msgid "" ":class:`!ByteString` was originally intended to be an abstract class that " "would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " @@ -5977,286 +5982,286 @@ msgstr "" "其他常見的緩衝區型別如 :class:`memoryview` 也從未被理解為 :class:`!" "ByteString` 的子型別(無論是在 runtime 還是由靜態型別檢查器)。" -#: ../../library/typing.rst:3830 +#: ../../library/typing.rst:3834 msgid "See :pep:`PEP 688 <688#current-options>` for more details." msgstr "更多細節請見 :pep:`PEP 688 <688#current-options>`。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3840 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3840 +#: ../../library/typing.rst:3844 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3850 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3848 +#: ../../library/typing.rst:3852 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3854 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3856 +#: ../../library/typing.rst:3860 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3866 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3864 +#: ../../library/typing.rst:3868 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3870 +#: ../../library/typing.rst:3874 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3872 +#: ../../library/typing.rst:3876 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3878 +#: ../../library/typing.rst:3882 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3880 +#: ../../library/typing.rst:3884 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3886 +#: ../../library/typing.rst:3890 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3888 +#: ../../library/typing.rst:3892 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3899 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3897 +#: ../../library/typing.rst:3901 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3904 +#: ../../library/typing.rst:3908 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3906 +#: ../../library/typing.rst:3910 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3916 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3918 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3924 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3922 +#: ../../library/typing.rst:3926 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3929 +#: ../../library/typing.rst:3933 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3933 +#: ../../library/typing.rst:3937 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3935 +#: ../../library/typing.rst:3939 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3941 +#: ../../library/typing.rst:3945 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3947 +#: ../../library/typing.rst:3951 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3949 +#: ../../library/typing.rst:3953 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3955 +#: ../../library/typing.rst:3959 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3960 +#: ../../library/typing.rst:3964 msgid "The ``SendType`` parameter now has a default." msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3965 +#: ../../library/typing.rst:3969 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3969 +#: ../../library/typing.rst:3973 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3975 +#: ../../library/typing.rst:3979 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3979 +#: ../../library/typing.rst:3983 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3985 +#: ../../library/typing.rst:3989 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3989 +#: ../../library/typing.rst:3993 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3996 +#: ../../library/typing.rst:4000 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:4000 +#: ../../library/typing.rst:4004 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:4002 +#: ../../library/typing.rst:4006 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4008 +#: ../../library/typing.rst:4012 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:4010 +#: ../../library/typing.rst:4014 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4016 +#: ../../library/typing.rst:4020 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:4018 +#: ../../library/typing.rst:4022 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:4021 +#: ../../library/typing.rst:4025 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4031 +#: ../../library/typing.rst:4035 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:4033 +#: ../../library/typing.rst:4037 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:4037 +#: ../../library/typing.rst:4041 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4041 +#: ../../library/typing.rst:4045 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:4046 +#: ../../library/typing.rst:4050 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:4048 +#: ../../library/typing.rst:4052 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:4053 +#: ../../library/typing.rst:4057 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:4055 +#: ../../library/typing.rst:4059 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4061 +#: ../../library/typing.rst:4065 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:4063 +#: ../../library/typing.rst:4067 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:4069 +#: ../../library/typing.rst:4073 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:4073 +#: ../../library/typing.rst:4077 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:4075 +#: ../../library/typing.rst:4079 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -6264,21 +6269,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:4082 +#: ../../library/typing.rst:4086 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4087 +#: ../../library/typing.rst:4091 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:4092 +#: ../../library/typing.rst:4096 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:4094 +#: ../../library/typing.rst:4098 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -6286,21 +6291,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:4101 +#: ../../library/typing.rst:4105 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:4106 +#: ../../library/typing.rst:4110 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:4110 +#: ../../library/typing.rst:4114 msgid "Deprecation Timeline of Major Features" msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:4112 +#: ../../library/typing.rst:4116 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -6308,112 +6313,112 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:4119 +#: ../../library/typing.rst:4123 msgid "Feature" msgstr "" -#: ../../library/typing.rst:4120 +#: ../../library/typing.rst:4124 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:4121 +#: ../../library/typing.rst:4125 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:4122 +#: ../../library/typing.rst:4126 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:4123 +#: ../../library/typing.rst:4127 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:4124 ../../library/typing.rst:4128 +#: ../../library/typing.rst:4128 ../../library/typing.rst:4132 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:4125 +#: ../../library/typing.rst:4129 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:4126 +#: ../../library/typing.rst:4130 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:4127 +#: ../../library/typing.rst:4131 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:4129 +#: ../../library/typing.rst:4133 msgid "3.17" msgstr "3.17" -#: ../../library/typing.rst:4130 +#: ../../library/typing.rst:4134 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:4131 +#: ../../library/typing.rst:4135 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:4132 +#: ../../library/typing.rst:4136 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:4133 ../../library/typing.rst:4137 -#: ../../library/typing.rst:4141 +#: ../../library/typing.rst:4137 ../../library/typing.rst:4141 +#: ../../library/typing.rst:4145 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:4134 +#: ../../library/typing.rst:4138 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:4135 +#: ../../library/typing.rst:4139 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:4136 ../../library/typing.rst:4140 +#: ../../library/typing.rst:4140 ../../library/typing.rst:4144 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:4138 +#: ../../library/typing.rst:4142 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:4139 +#: ../../library/typing.rst:4143 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:4142 +#: ../../library/typing.rst:4146 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:4143 +#: ../../library/typing.rst:4147 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:4144 ../../library/typing.rst:4148 +#: ../../library/typing.rst:4148 ../../library/typing.rst:4152 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4145 +#: ../../library/typing.rst:4149 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:4146 +#: ../../library/typing.rst:4150 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:4147 +#: ../../library/typing.rst:4151 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4149 +#: ../../library/typing.rst:4153 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:4150 +#: ../../library/typing.rst:4154 msgid ":gh:`105578`" msgstr ":gh:`105578`" diff --git a/sphinx.po b/sphinx.po index 388ff999d6..41c4f9ed6d 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-19 00:20+0000\n" +"POT-Creation-Date: 2026-04-23 00:30+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -241,23 +241,27 @@ msgstr "自從版本 %s 後不推薦使用,將會自版本 %s 中移除。" msgid "Deprecated since version %s, removed in version %s" msgstr "自從版本 %s 後不推薦使用,已從版本 %s 中移除。" -#: ../../tools/templates/dummy.html:35 +#: ../../tools/templates/dummy.html:32 +msgid ":term:`Soft deprecated` since version %s" +msgstr "" + +#: ../../tools/templates/dummy.html:36 msgid "in development" msgstr "開發中" -#: ../../tools/templates/dummy.html:36 +#: ../../tools/templates/dummy.html:37 msgid "pre-release" msgstr "預發行" -#: ../../tools/templates/dummy.html:37 +#: ../../tools/templates/dummy.html:38 msgid "stable" msgstr "穩定版本" -#: ../../tools/templates/dummy.html:38 +#: ../../tools/templates/dummy.html:39 msgid "security-fixes" msgstr "安全性修護" -#: ../../tools/templates/dummy.html:39 +#: ../../tools/templates/dummy.html:40 msgid "EOL" msgstr "停止維護" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index d3ed9e07f7..594fe3f582 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-08 15:25+0800\n" +"POT-Creation-Date: 2026-04-29 00:33+0000\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,8 @@ msgstr "" "X-Generator: Poedit 2.4.3\n" #: ../../tutorial/stdlib2.rst:5 -msgid "Brief Tour of the Standard Library --- Part II" +#, fuzzy +msgid "Brief tour of the standard library --- part II" msgstr "Python 標準函式庫概覽——第二部份" #: ../../tutorial/stdlib2.rst:7 @@ -34,7 +35,8 @@ msgstr "" "中。" #: ../../tutorial/stdlib2.rst:14 -msgid "Output Formatting" +#, fuzzy +msgid "Output formatting" msgstr "輸出格式化 (Output Formatting)" #: ../../tutorial/stdlib2.rst:16 @@ -199,15 +201,15 @@ msgstr "" msgid "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " "a placeholder is not supplied in a dictionary or a keyword argument. For " -"mail-merge style applications, user supplied data may be incomplete and " -"the :meth:`~string.Template.safe_substitute` method may be more appropriate " -"--- it will leave placeholders unchanged if data is missing::" +"mail-merge style applications, user supplied data may be incomplete and the :" +"meth:`~string.Template.safe_substitute` method may be more appropriate --- " +"it will leave placeholders unchanged if data is missing::" msgstr "" -"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那" -"麼 :meth:`~string.Template.substitute` method 將引發 :exc:`KeyError`。對於郵" -"件合併 (mail-merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使" -"用 :meth:`~string.Template.safe_substitute` method 會更適當——如果資料有缺少," -"它會保持佔位符號不變: ::" +"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那麼 :meth:`~string." +"Template.substitute` method 將引發 :exc:`KeyError`。對於郵件合併 (mail-" +"merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使用 :meth:" +"`~string.Template.safe_substitute` method 會更適當——如果資料有缺少,它會保持" +"佔位符號不變: ::" #: ../../tutorial/stdlib2.rst:94 msgid "" @@ -290,25 +292,26 @@ msgstr "" "XML 檔案、純文字報表和 HTML 網路報表替換自訂的模板。" #: ../../tutorial/stdlib2.rst:134 -msgid "Working with Binary Data Record Layouts" +#, fuzzy +msgid "Working with binary data record layouts" msgstr "二進制資料記錄編排 (Binary Data Record Layouts)" #: ../../tutorial/stdlib2.rst:136 msgid "" -"The :mod:`struct` module provides :func:`~struct.pack` " -"and :func:`~struct.unpack` functions for working with variable length binary " -"record formats. The following example shows how to loop through header " -"information in a ZIP file without using the :mod:`zipfile` module. Pack " -"codes ``\"H\"`` and ``\"I\"`` represent two and four byte unsigned numbers " -"respectively. The ``\"<\"`` indicates that they are standard size and in " -"little-endian byte order::" +"The :mod:`struct` module provides :func:`~struct.pack` and :func:`~struct." +"unpack` functions for working with variable length binary record formats. " +"The following example shows how to loop through header information in a ZIP " +"file without using the :mod:`zipfile` module. Pack codes ``\"H\"`` and " +"``\"I\"`` represent two and four byte unsigned numbers respectively. The " +"``\"<\"`` indicates that they are standard size and in little-endian byte " +"order::" msgstr "" ":mod:`struct` 模組提供了 :func:`~struct.pack` 和 :func:`~struct.unpack` 函" -"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使" -"用 :mod:`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 " -"(header information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位" -"元組的無符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 " -"(little-endian) 位元組順序: ::" +"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使用 :mod:" +"`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 (header " +"information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位元組的無" +"符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 (little-" +"endian) 位元組順序: ::" #: ../../tutorial/stdlib2.rst:144 msgid "" @@ -376,19 +379,19 @@ msgstr "" "繼續運行: ::" #: ../../tutorial/stdlib2.rst:177 +#, fuzzy msgid "" "import threading, zipfile\n" "\n" "class AsyncZip(threading.Thread):\n" " def __init__(self, infile, outfile):\n" -" threading.Thread.__init__(self)\n" +" super().__init__()\n" " self.infile = infile\n" " self.outfile = outfile\n" "\n" " def run(self):\n" -" f = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED)\n" -" f.write(self.infile)\n" -" f.close()\n" +" with zipfile.ZipFile(self.outfile, 'w', zipfile.ZIP_DEFLATED) as f:\n" +" f.write(self.infile)\n" " print('Finished background zip of:', self.infile)\n" "\n" "background = AsyncZip('mydata.txt', 'myarchive.zip')\n" @@ -419,7 +422,7 @@ msgstr "" "background.join() # 等待背景任務結束\n" "print('Main program waited until background was done.')" -#: ../../tutorial/stdlib2.rst:198 +#: ../../tutorial/stdlib2.rst:197 msgid "" "The principal challenge of multi-threaded applications is coordinating " "threads that share data or other resources. To that end, the threading " @@ -427,10 +430,10 @@ msgid "" "events, condition variables, and semaphores." msgstr "" "多執行緒應用程式的主要挑戰是,要協調多個彼此共享資料或資源的執行緒。為此," -"threading 模組提供了多個同步原語 (synchronization primitive),包括鎖 " -"(lock)、事件 (event)、條件變數 (condition variable) 和號誌 (semaphore)。" +"threading 模組提供了多個同步原語 (synchronization primitive),包括鎖 (lock)、" +"事件 (event)、條件變數 (condition variable) 和號誌 (semaphore)。" -#: ../../tutorial/stdlib2.rst:203 +#: ../../tutorial/stdlib2.rst:202 msgid "" "While those tools are powerful, minor design errors can result in problems " "that are difficult to reproduce. So, the preferred approach to task " @@ -441,25 +444,24 @@ msgid "" "and more reliable." msgstr "" "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務" -"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使" -"用 :mod:`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使" -"用 :class:`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、" -"更可靠。" +"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:" +"`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:" +"`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。" -#: ../../tutorial/stdlib2.rst:214 +#: ../../tutorial/stdlib2.rst:213 msgid "Logging" msgstr "日誌記錄 (Logging)" -#: ../../tutorial/stdlib2.rst:216 +#: ../../tutorial/stdlib2.rst:215 msgid "" "The :mod:`logging` module offers a full featured and flexible logging " -"system. At its simplest, log messages are sent to a file or to " -"``sys.stderr``::" +"system. At its simplest, log messages are sent to a file or to ``sys." +"stderr``::" msgstr "" ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌" "訊息會被發送到檔案或 ``sys.stderr``: ::" -#: ../../tutorial/stdlib2.rst:219 +#: ../../tutorial/stdlib2.rst:218 msgid "" "import logging\n" "logging.debug('Debugging information')\n" @@ -475,11 +477,11 @@ msgstr "" "logging.error('Error occurred')\n" "logging.critical('Critical error -- shutting down')" -#: ../../tutorial/stdlib2.rst:226 +#: ../../tutorial/stdlib2.rst:225 msgid "This produces the following output:" msgstr "這會產生以下輸出:" -#: ../../tutorial/stdlib2.rst:228 +#: ../../tutorial/stdlib2.rst:227 msgid "" "WARNING:root:Warning:config file server.conf not found\n" "ERROR:root:Error occurred\n" @@ -489,23 +491,22 @@ msgstr "" "ERROR:root:Error occurred\n" "CRITICAL:root:Critical error -- shutting down" -#: ../../tutorial/stdlib2.rst:234 +#: ../../tutorial/stdlib2.rst:233 msgid "" "By default, informational and debugging messages are suppressed and the " "output is sent to standard error. Other output options include routing " "messages through email, datagrams, sockets, or to an HTTP Server. New " -"filters can select different routing based on message " -"priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, " -"and :const:`~logging.CRITICAL`." +"filters can select different routing based on message priority: :const:" +"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:" +"`~logging.ERROR`, and :const:`~logging.CRITICAL`." msgstr "" "在預設情況,資訊和除錯訊息不會被顯示,其輸出會被發送到標準錯誤 (standard " "error)。其他輸出選項包括,將訊息轉發到電子郵件、資料報 (datagram)、網路插座 " "(socket) 或 HTTP 伺服器。新的過濾器可以根據訊息的優先順序,選擇不同的路由 " -"(routing) 方" -"式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:`~logging.WARNING`、:const:`~logging.ERROR` " -"及 :const:`~logging.CRITICAL`。" +"(routing) 方式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:" +"`~logging.WARNING`、:const:`~logging.ERROR` 及 :const:`~logging.CRITICAL`。" -#: ../../tutorial/stdlib2.rst:241 +#: ../../tutorial/stdlib2.rst:240 msgid "" "The logging system can be configured directly from Python or can be loaded " "from a user editable configuration file for customized logging without " @@ -514,11 +515,12 @@ msgstr "" "日誌記錄系統可以直接從 Python 配置,也可以透過載入使用者可編輯的配置檔案以進" "行客製化的日誌記錄,而無須對應用程式做出變更。" -#: ../../tutorial/stdlib2.rst:249 -msgid "Weak References" +#: ../../tutorial/stdlib2.rst:248 +#, fuzzy +msgid "Weak references" msgstr "弱引用 (Weak References)" -#: ../../tutorial/stdlib2.rst:251 +#: ../../tutorial/stdlib2.rst:250 msgid "" "Python does automatic memory management (reference counting for most objects " "and :term:`garbage collection` to eliminate cycles). The memory is freed " @@ -528,7 +530,7 @@ msgstr "" "使用 :term:`garbage collection` 來消除循環參照)。當一個參照從記憶體被移除後" "不久,該記憶體就會被釋出。" -#: ../../tutorial/stdlib2.rst:255 +#: ../../tutorial/stdlib2.rst:254 msgid "" "This approach works fine for most applications but occasionally there is a " "need to track objects only as long as they are being used by something else. " @@ -546,7 +548,7 @@ msgstr "" "為弱引用物件觸發一個回呼 (callback)。典型的應用包括暫存 (cache) 那些成本較為" "昂貴的物件: ::" -#: ../../tutorial/stdlib2.rst:263 +#: ../../tutorial/stdlib2.rst:262 msgid "" ">>> import weakref, gc\n" ">>> class A:\n" @@ -594,11 +596,12 @@ msgstr "" " o = self.data[key]()\n" "KeyError: 'primary'" -#: ../../tutorial/stdlib2.rst:290 -msgid "Tools for Working with Lists" +#: ../../tutorial/stdlib2.rst:289 +#, fuzzy +msgid "Tools for working with lists" msgstr "使用於 List 的工具" -#: ../../tutorial/stdlib2.rst:292 +#: ../../tutorial/stdlib2.rst:291 msgid "" "Many data structure needs can be met with the built-in list type. However, " "sometimes there is a need for alternative implementations with different " @@ -607,7 +610,7 @@ msgstr "" "許多對於資料結構的需求,可以透過內建的 list(串列)型別來滿足。但是,有時也會" "根據效能的各種取捨,需要一些替代的實作。" -#: ../../tutorial/stdlib2.rst:296 +#: ../../tutorial/stdlib2.rst:295 msgid "" "The :mod:`array` module provides an :class:`~array.array` object that is " "like a list that stores only homogeneous data and stores it more compactly. " @@ -620,7 +623,7 @@ msgstr "" "的無符號二進數 (unsigned binary numbers) 為儲存單位(類型碼為 ``\"H\"``),而" "在 Python 整數物件的正規 list 中,每個項目通常使用 16 個位元組: ::" -#: ../../tutorial/stdlib2.rst:302 +#: ../../tutorial/stdlib2.rst:301 msgid "" ">>> from array import array\n" ">>> a = array('H', [4000, 10, 700, 22222])\n" @@ -636,7 +639,7 @@ msgstr "" ">>> a[1:3]\n" "array('H', [10, 700])" -#: ../../tutorial/stdlib2.rst:309 +#: ../../tutorial/stdlib2.rst:308 msgid "" "The :mod:`collections` module provides a :class:`~collections.deque` object " "that is like a list with faster appends and pops from the left side but " @@ -648,7 +651,7 @@ msgstr "" "慢。這種物件適用於實作佇列 (queue) 和廣度優先搜尋法 (breadth first tree " "search): ::" -#: ../../tutorial/stdlib2.rst:314 +#: ../../tutorial/stdlib2.rst:313 msgid "" ">>> from collections import deque\n" ">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" @@ -662,7 +665,7 @@ msgstr "" ">>> print(\"Handling\", d.popleft())\n" "Handling task1" -#: ../../tutorial/stdlib2.rst:322 +#: ../../tutorial/stdlib2.rst:321 msgid "" "unsearched = deque([starting_node])\n" "def breadth_first_search(unsearched):\n" @@ -680,7 +683,7 @@ msgstr "" " return m\n" " unsearched.append(m)" -#: ../../tutorial/stdlib2.rst:330 +#: ../../tutorial/stdlib2.rst:329 msgid "" "In addition to alternative list implementations, the library also offers " "other tools such as the :mod:`bisect` module with functions for manipulating " @@ -689,7 +692,7 @@ msgstr "" "除了替代的 list 實作以外,函式庫也提供了其他工具,例如 :mod:`bisect` 模組,具" "有能夠操作 sorted list(已排序串列)的函式: ::" -#: ../../tutorial/stdlib2.rst:334 +#: ../../tutorial/stdlib2.rst:333 msgid "" ">>> import bisect\n" ">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" @@ -703,7 +706,7 @@ msgstr "" ">>> scores\n" "[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]" -#: ../../tutorial/stdlib2.rst:340 +#: ../../tutorial/stdlib2.rst:339 msgid "" "The :mod:`heapq` module provides functions for implementing heaps based on " "regular lists. The lowest valued entry is always kept at position zero. " @@ -714,7 +717,7 @@ msgstr "" "項目會永遠保持在位置零。對於一些需要多次存取最小元素,但不想要對整個 list 進" "行排序的應用程式來說,這會很有用: ::" -#: ../../tutorial/stdlib2.rst:345 +#: ../../tutorial/stdlib2.rst:344 msgid "" ">>> from heapq import heapify, heappop, heappush\n" ">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n" @@ -730,11 +733,12 @@ msgstr "" ">>> [heappop(data) for i in range(3)] # 取得三個最小的項目\n" "[-5, 0, 1]" -#: ../../tutorial/stdlib2.rst:356 -msgid "Decimal Floating-Point Arithmetic" +#: ../../tutorial/stdlib2.rst:355 +#, fuzzy +msgid "Decimal floating-point arithmetic" msgstr "十進制浮點數運算 (Decimal Floating-Point Arithmetic)" -#: ../../tutorial/stdlib2.rst:358 +#: ../../tutorial/stdlib2.rst:357 msgid "" "The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for " "decimal floating-point arithmetic. Compared to the built-in :class:`float` " @@ -744,31 +748,31 @@ msgstr "" "浮點數運算。相較於內建的二進制浮點數 :class:`float` 實作,該 class 特別適用於" "下列情境" -#: ../../tutorial/stdlib2.rst:362 +#: ../../tutorial/stdlib2.rst:361 msgid "" "financial applications and other uses which require exact decimal " "representation," msgstr "金融應用程式及其他需要準確十進位制表示法的應用," -#: ../../tutorial/stdlib2.rst:364 +#: ../../tutorial/stdlib2.rst:363 msgid "control over precision," msgstr "對於精確度 (precision) 的控制," -#: ../../tutorial/stdlib2.rst:365 +#: ../../tutorial/stdlib2.rst:364 msgid "control over rounding to meet legal or regulatory requirements," msgstr "控制四捨五入,以滿足法律或監管規範," -#: ../../tutorial/stdlib2.rst:366 +#: ../../tutorial/stdlib2.rst:365 msgid "tracking of significant decimal places, or" msgstr "追蹤有效的小數位數 (decimal place),或" -#: ../../tutorial/stdlib2.rst:367 +#: ../../tutorial/stdlib2.rst:366 msgid "" "applications where the user expects the results to match calculations done " "by hand." msgstr "使用者會期望計算結果與手工計算相符的應用程式。" -#: ../../tutorial/stdlib2.rst:370 +#: ../../tutorial/stdlib2.rst:369 msgid "" "For example, calculating a 5% tax on a 70 cent phone charge gives different " "results in decimal floating point and binary floating point. The difference " @@ -778,7 +782,7 @@ msgstr "" "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更" "顯著: ::" -#: ../../tutorial/stdlib2.rst:374 +#: ../../tutorial/stdlib2.rst:373 msgid "" ">>> from decimal import *\n" ">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n" @@ -792,7 +796,7 @@ msgstr "" ">>> round(.70 * 1.05, 2)\n" "0.73" -#: ../../tutorial/stdlib2.rst:380 +#: ../../tutorial/stdlib2.rst:379 msgid "" "The :class:`~decimal.Decimal` result keeps a trailing zero, automatically " "inferring four place significance from multiplicands with two place " @@ -804,7 +808,7 @@ msgstr "" "被乘數自動推斷出有四個有效位數的乘積。Decimal 可以重現手工計算的結果,以避免" "產生二進制浮點數無法準確表示十進制數值時會導致的問題。" -#: ../../tutorial/stdlib2.rst:386 +#: ../../tutorial/stdlib2.rst:385 msgid "" "Exact representation enables the :class:`~decimal.Decimal` class to perform " "modulo calculations and equality tests that are unsuitable for binary " @@ -813,7 +817,7 @@ msgstr "" "準確的表示法使得 :class:`~decimal.Decimal` class 能夠執行對於二進制浮點數不適" "用的模數計算和相等性檢測: ::" -#: ../../tutorial/stdlib2.rst:390 +#: ../../tutorial/stdlib2.rst:389 msgid "" ">>> Decimal('1.00') % Decimal('.10')\n" "Decimal('0.00')\n" @@ -835,13 +839,13 @@ msgstr "" ">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" "False" -#: ../../tutorial/stdlib2.rst:400 +#: ../../tutorial/stdlib2.rst:399 msgid "" "The :mod:`decimal` module provides arithmetic with as much precision as " "needed::" msgstr ":mod:`decimal` 模組可提供運算中需要的足夠精確度: ::" -#: ../../tutorial/stdlib2.rst:402 +#: ../../tutorial/stdlib2.rst:401 msgid "" ">>> getcontext().prec = 36\n" ">>> Decimal(1) / Decimal(7)\n" diff --git a/using/android.po b/using/android.po index 029b282b09..699cd6f508 100644 --- a/using/android.po +++ b/using/android.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-19 00:15+0000\n" +"POT-Creation-Date: 2026-04-20 00:26+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,10 +29,9 @@ msgid "" "running a :program:`python` executable and entering commands at an " "interactive prompt, or by running a Python script." msgstr "" -"Android 上的 Python 與桌面版的 Python 不同。在桌面版上,Python 通常作為系統" -"資源安裝,供該台電腦上的任何使用者使用。使用者通常透過執行 :program:`python` " -"可執行檔並在互動式提示字元中輸入指令,或是直接執行 Python 腳本與 Python 互" -"動。" +"Android 上的 Python 與桌面版的 Python 不同。在桌面版上,Python 通常作為系統資" +"源安裝,供該台電腦上的任何使用者使用。使用者通常透過執行 :program:`python` 可" +"執行檔並在互動式提示字元中輸入指令,或是直接執行 Python 腳本與 Python 互動。" #: ../../using/android.rst:13 msgid "" @@ -53,10 +52,10 @@ msgid "" "for its own private use." msgstr "" "因此,在 Android 上使用 Python 的唯一方式就是以嵌入模式運作 - 也就是撰寫一個" -"原生的 Android 應用程式,使用 ``libpython`` 嵌入 Python 直譯器,並透" -"過 :ref:`Python 嵌入式 API ` 呼叫 Python 程式碼。完整的 Python " -"直譯器、標準函式庫,以及你所有的 Python 程式碼,都會被打包進你的應用程式,供" -"該應用程式使用。" +"原生的 Android 應用程式,使用 ``libpython`` 嵌入 Python 直譯器,並透過 :ref:" +"`Python 嵌入式 API ` 呼叫 Python 程式碼。完整的 Python 直譯器、標" +"準函式庫,以及你所有的 Python 程式碼,都會被打包進你的應用程式,供該應用程式" +"使用。" #: ../../using/android.rst:23 msgid "" @@ -80,9 +79,8 @@ msgstr "" "驗:" #: ../../using/android.rst:33 -msgid "" -"`Briefcase `__, from the BeeWare project" -msgstr "`Briefcase `__,由 BeeWare 專案提供" +msgid "`Briefcase `__, from the BeeWare project" +msgstr "`Briefcase `__,由 BeeWare 專案提供" #: ../../using/android.rst:34 msgid "`Buildozer `__, from the Kivy project" diff --git a/whatsnew/3.14.po b/whatsnew/3.14.po index 1f40c63f14..7095c09188 100644 --- a/whatsnew/3.14.po +++ b/whatsnew/3.14.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-03-26 00:23+0000\n" +"POT-Creation-Date: 2026-05-02 00:31+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1491,17 +1491,38 @@ msgstr "" msgid "(Contributed by Irit Katriel in :gh:`130080`.)" msgstr "(由 Irit Katriel 於 :gh:`130080` 貢獻。)" -#: ../../whatsnew/3.14.rst:960 -msgid "Incremental garbage collection" +#: ../../whatsnew/3.14.rst:961 +msgid "Garbage collection" msgstr "" -#: ../../whatsnew/3.14.rst:962 +#: ../../whatsnew/3.14.rst:963 ../../whatsnew/3.14.rst:2221 +msgid "**From Python 3.14.5 onwards:**" +msgstr "" + +#: ../../whatsnew/3.14.rst:965 +msgid "The garbage collector (GC) has changed in Python 3.14.5." +msgstr "" + +#: ../../whatsnew/3.14.rst:967 +msgid "" +"Python 3.14.0-3.14.4 shipped with a new incremental GC. However, due to a " +"number of `reports `__ of " +"significant memory pressure in production environments, it has been reverted " +"back to the generational GC from 3.13. This is the GC now used in Python " +"3.14.5 and later." +msgstr "" + +#: ../../whatsnew/3.14.rst:974 ../../whatsnew/3.14.rst:2230 +msgid "**Previously in Python 3.14.0-3.14.4:**" +msgstr "" + +#: ../../whatsnew/3.14.rst:976 msgid "" "The cycle garbage collector is now incremental. This means that maximum " "pause times are reduced by an order of magnitude or more for larger heaps." msgstr "" -#: ../../whatsnew/3.14.rst:966 +#: ../../whatsnew/3.14.rst:980 msgid "" "There are now only two generations: young and old. When :func:`gc.collect` " "is not called directly, the GC is invoked a little less frequently. When " @@ -1509,29 +1530,29 @@ msgid "" "generation, instead of collecting one or more generations." msgstr "" -#: ../../whatsnew/3.14.rst:972 +#: ../../whatsnew/3.14.rst:986 msgid "The behavior of :func:`!gc.collect` changes slightly:" msgstr "" -#: ../../whatsnew/3.14.rst:974 ../../whatsnew/3.14.rst:3278 +#: ../../whatsnew/3.14.rst:988 ../../whatsnew/3.14.rst:3303 msgid "" "``gc.collect(1)``: Performs an increment of garbage collection, rather than " "collecting generation 1." msgstr "" -#: ../../whatsnew/3.14.rst:976 ../../whatsnew/3.14.rst:3280 +#: ../../whatsnew/3.14.rst:990 ../../whatsnew/3.14.rst:3305 msgid "Other calls to :func:`!gc.collect` are unchanged." msgstr "" -#: ../../whatsnew/3.14.rst:978 ../../whatsnew/3.14.rst:2236 +#: ../../whatsnew/3.14.rst:992 ../../whatsnew/3.14.rst:2261 msgid "(Contributed by Mark Shannon in :gh:`108362`.)" msgstr "(由 Mark Shannon 於 :gh:`108362` 貢獻。)" -#: ../../whatsnew/3.14.rst:982 +#: ../../whatsnew/3.14.rst:996 msgid "Default interactive shell" msgstr "" -#: ../../whatsnew/3.14.rst:986 +#: ../../whatsnew/3.14.rst:1000 msgid "" "The default :term:`interactive` shell now highlights Python syntax. The " "feature is enabled by default, save if :envvar:`PYTHON_BASIC_REPL` or any " @@ -1539,7 +1560,7 @@ msgid "" "controlling-color` for details." msgstr "" -#: ../../whatsnew/3.14.rst:991 +#: ../../whatsnew/3.14.rst:1005 msgid "" "The default color theme for syntax highlighting strives for good contrast " "and exclusively uses the 4-bit VGA standard ANSI color codes for maximum " @@ -1549,11 +1570,11 @@ msgid "" "and may change or be removed." msgstr "" -#: ../../whatsnew/3.14.rst:999 +#: ../../whatsnew/3.14.rst:1013 msgid "(Contributed by Łukasz Langa in :gh:`131507`.)" msgstr "(由 Łukasz Langa 於 :gh:`131507` 貢獻。)" -#: ../../whatsnew/3.14.rst:1001 +#: ../../whatsnew/3.14.rst:1015 msgid "" "The default :term:`interactive` shell now supports import auto-completion. " "This means that typing ``import co`` and pressing :kbd:`` will suggest " @@ -1563,18 +1584,18 @@ msgid "" "by Tomas Roun in :gh:`69605`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1010 +#: ../../whatsnew/3.14.rst:1024 msgid "New modules" msgstr "新增模組" -#: ../../whatsnew/3.14.rst:1012 +#: ../../whatsnew/3.14.rst:1026 msgid "" ":mod:`annotationlib`: For introspecting :term:`annotations `. " "See :ref:`PEP 749 ` for more details. " "(Contributed by Jelle Zijlstra in :gh:`119180`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1017 +#: ../../whatsnew/3.14.rst:1031 msgid "" ":mod:`compression` (including :mod:`compression.zstd`): A package for " "compression-related modules, including a new module to support the Zstandard " @@ -1583,14 +1604,14 @@ msgid "" "Tomas Roun, Victor Stinner, and Rogdham in :gh:`132983`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1024 +#: ../../whatsnew/3.14.rst:1038 msgid "" ":mod:`concurrent.interpreters`: Support for multiple interpreters in the " "standard library. See :ref:`PEP 734 ` for " "more details. (Contributed by Eric Snow in :gh:`134939`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1029 +#: ../../whatsnew/3.14.rst:1043 msgid "" ":mod:`string.templatelib`: Support for template string literals (t-strings). " "See :ref:`PEP 750 ` for more details. " @@ -1599,15 +1620,15 @@ msgid "" "and Pablo Galindo Salgado in :gh:`132661`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1038 +#: ../../whatsnew/3.14.rst:1052 msgid "Improved modules" msgstr "改進的模組" -#: ../../whatsnew/3.14.rst:1041 ../../whatsnew/3.14.rst:2310 +#: ../../whatsnew/3.14.rst:1055 ../../whatsnew/3.14.rst:2335 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.14.rst:1043 +#: ../../whatsnew/3.14.rst:1057 msgid "" "The default value of the :ref:`program name ` for :class:`argparse." "ArgumentParser` now reflects the way the Python interpreter was instructed " @@ -1615,7 +1636,7 @@ msgid "" "Alyssa Coghlan in :gh:`66436`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1048 +#: ../../whatsnew/3.14.rst:1062 msgid "" "Introduced the optional *suggest_on_error* parameter to :class:`argparse." "ArgumentParser`, enabling suggestions for argument choices and subparser " @@ -1623,7 +1644,7 @@ msgid "" "`124456`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1053 +#: ../../whatsnew/3.14.rst:1067 msgid "" "Enable color for help text, which can be disabled with the optional *color* " "parameter to :class:`argparse.ArgumentParser`. This can also be controlled " @@ -1631,42 +1652,42 @@ msgid "" "by Hugo van Kemenade in :gh:`130645`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1061 ../../whatsnew/3.14.rst:2329 +#: ../../whatsnew/3.14.rst:1075 ../../whatsnew/3.14.rst:2354 msgid "ast" msgstr "ast" -#: ../../whatsnew/3.14.rst:1063 +#: ../../whatsnew/3.14.rst:1077 msgid "" "Add :func:`~ast.compare`, a function for comparing two ASTs. (Contributed by " "Batuhan Taskaya and Jeremy Hylton in :gh:`60191`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1066 +#: ../../whatsnew/3.14.rst:1080 msgid "" "Add support for :func:`copy.replace` for AST nodes. (Contributed by Bénédikt " "Tran in :gh:`121141`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1069 +#: ../../whatsnew/3.14.rst:1083 msgid "" "Docstrings are now removed from an optimized AST in optimization level 2. " "(Contributed by Irit Katriel in :gh:`123958`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1072 +#: ../../whatsnew/3.14.rst:1086 msgid "" "The :func:`repr` output for AST nodes now includes more information. " "(Contributed by Tomas Roun in :gh:`116022`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1075 +#: ../../whatsnew/3.14.rst:1089 msgid "" "When called with an AST as input, the :func:`~ast.parse` function now always " "verifies that the root node type is appropriate. (Contributed by Irit " "Katriel in :gh:`130139`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1079 +#: ../../whatsnew/3.14.rst:1093 msgid "" "Add new options to the command-line interface: :option:`--feature-version " "`, :option:`--optimize `, and :option:" @@ -1674,12 +1695,12 @@ msgid "" "`133367`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1087 ../../whatsnew/3.14.rst:2162 -#: ../../whatsnew/3.14.rst:2360 +#: ../../whatsnew/3.14.rst:1101 ../../whatsnew/3.14.rst:2176 +#: ../../whatsnew/3.14.rst:2385 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.14.rst:1089 +#: ../../whatsnew/3.14.rst:1103 msgid "" "The function and methods named :func:`!create_task` now take an arbitrary " "list of keyword arguments. All keyword arguments are passed to the :class:" @@ -1689,18 +1710,18 @@ msgid "" "``name`` keyword argument of the factory, and ``context`` may be ``None``." msgstr "" -#: ../../whatsnew/3.14.rst:1097 +#: ../../whatsnew/3.14.rst:1111 msgid "" "This affects the following function and methods: :meth:`asyncio." "create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." "create_task`." msgstr "" -#: ../../whatsnew/3.14.rst:1102 +#: ../../whatsnew/3.14.rst:1116 msgid "(Contributed by Thomas Grainger in :gh:`128307`.)" msgstr "(由 Thomas Grainger 於 :gh:`128307` 貢獻。)" -#: ../../whatsnew/3.14.rst:1104 +#: ../../whatsnew/3.14.rst:1118 msgid "" "There are two new utility functions for introspecting and printing a " "program's call graph: :func:`~asyncio.capture_call_graph` and :func:" @@ -1709,11 +1730,11 @@ msgid "" "Selivanov, Pablo Galindo Salgado, and Łukasz Langa in :gh:`91048`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1114 +#: ../../whatsnew/3.14.rst:1128 msgid "calendar" msgstr "calendar" -#: ../../whatsnew/3.14.rst:1118 +#: ../../whatsnew/3.14.rst:1132 msgid "" "By default, today's date is highlighted in color in :mod:`calendar`'s :ref:" "`command-line ` text output. This can be controlled by :ref:" @@ -1721,11 +1742,11 @@ msgid "" "van Kemenade in :gh:`128317`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1126 +#: ../../whatsnew/3.14.rst:1140 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.14.rst:1130 +#: ../../whatsnew/3.14.rst:1144 msgid "" "Add a new executor class, :class:`~concurrent.futures." "InterpreterPoolExecutor`, which exposes multiple Python interpreters in the " @@ -1733,14 +1754,14 @@ msgid "" "independent Python interpreters to execute calls asynchronously." msgstr "" -#: ../../whatsnew/3.14.rst:1136 +#: ../../whatsnew/3.14.rst:1150 msgid "" "This is separate from the new :mod:`~concurrent.interpreters` module " "introduced by :ref:`PEP 734 `. " "(Contributed by Eric Snow in :gh:`124548`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1142 +#: ../../whatsnew/3.14.rst:1156 msgid "" "On Unix platforms other than macOS, :ref:`'forkserver' ` is now the default :ref:`start method " @@ -1750,14 +1771,14 @@ msgid "" "` remains the default start method." msgstr "" -#: ../../whatsnew/3.14.rst:1150 +#: ../../whatsnew/3.14.rst:1164 msgid "" "If the threading incompatible *fork* method is required, you must explicitly " "request it by supplying a multiprocessing context *mp_context* to :class:" "`~concurrent.futures.ProcessPoolExecutor`." msgstr "" -#: ../../whatsnew/3.14.rst:1154 ../../whatsnew/3.14.rst:1604 +#: ../../whatsnew/3.14.rst:1168 ../../whatsnew/3.14.rst:1618 msgid "" "See :ref:`forkserver restrictions ` " "for information and differences with the *fork* method and how this change " @@ -1765,11 +1786,11 @@ msgid "" "objects that can not be automatically :mod:`pickled `." msgstr "" -#: ../../whatsnew/3.14.rst:1159 ../../whatsnew/3.14.rst:1609 +#: ../../whatsnew/3.14.rst:1173 ../../whatsnew/3.14.rst:1623 msgid "(Contributed by Gregory P. Smith in :gh:`84559`.)" msgstr "(由 Gregory P. Smith 於 :gh:`84559` 貢獻。)" -#: ../../whatsnew/3.14.rst:1161 +#: ../../whatsnew/3.14.rst:1175 msgid "" "Add two new methods to :class:`~concurrent.futures.ProcessPoolExecutor`, :" "meth:`~concurrent.futures.ProcessPoolExecutor.terminate_workers` and :meth:" @@ -1778,7 +1799,7 @@ msgid "" "Charles Machalow in :gh:`130849`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1167 +#: ../../whatsnew/3.14.rst:1181 msgid "" "Add the optional *buffersize* parameter to :meth:`Executor.map ` to limit the number of submitted tasks whose results " @@ -1787,11 +1808,11 @@ msgid "" "by Enzo Bonnal and Josh Rosenberg in :gh:`74028`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1176 +#: ../../whatsnew/3.14.rst:1190 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.14.rst:1178 +#: ../../whatsnew/3.14.rst:1192 msgid "" ":mod:`!configparser` will no longer write config files it cannot read, to " "improve security. Attempting to :meth:`~configparser.ConfigParser.write` " @@ -1800,21 +1821,21 @@ msgid "" "Lincoln in :gh:`129270`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1187 +#: ../../whatsnew/3.14.rst:1201 msgid "contextvars" msgstr "contextvars" -#: ../../whatsnew/3.14.rst:1189 +#: ../../whatsnew/3.14.rst:1203 msgid "" "Support the :term:`context manager` protocol for :class:`~contextvars.Token` " "objects. (Contributed by Andrew Svetlov in :gh:`129889`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1195 +#: ../../whatsnew/3.14.rst:1209 msgid "ctypes" msgstr "ctypes" -#: ../../whatsnew/3.14.rst:1197 +#: ../../whatsnew/3.14.rst:1211 msgid "" "The layout of :ref:`bit fields ` in :" "class:`~ctypes.Structure` and :class:`~ctypes.Union` objects is now a closer " @@ -1822,13 +1843,13 @@ msgid "" "longer overlap. (Contributed by Matthias Görgens in :gh:`97702`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1203 +#: ../../whatsnew/3.14.rst:1217 msgid "" "The :attr:`.Structure._layout_` class attribute can now be set to help match " "a non-default ABI. (Contributed by Petr Viktorin in :gh:`97702`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1207 +#: ../../whatsnew/3.14.rst:1221 msgid "" "The class of :class:`~ctypes.Structure`/:class:`~ctypes.Union` field " "descriptors is now available as :class:`~ctypes.CField`, and has new " @@ -1836,19 +1857,19 @@ msgid "" "in :gh:`128715`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1212 +#: ../../whatsnew/3.14.rst:1226 msgid "" "On Windows, the :exc:`~ctypes.COMError` exception is now public. " "(Contributed by Jun Komoda in :gh:`126686`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1215 +#: ../../whatsnew/3.14.rst:1229 msgid "" "On Windows, the :func:`~ctypes.CopyComPointer` function is now public. " "(Contributed by Jun Komoda in :gh:`127275`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1218 +#: ../../whatsnew/3.14.rst:1232 msgid "" "Add :func:`~ctypes.memoryview_at`, a function to create a :class:" "`memoryview` object that refers to the supplied pointer and length. This " @@ -1858,7 +1879,7 @@ msgid "" "`112018`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1225 +#: ../../whatsnew/3.14.rst:1239 msgid "" "Complex types, :class:`~ctypes.c_float_complex`, :class:`~ctypes." "c_double_complex`, and :class:`~ctypes.c_longdouble_complex`, are now " @@ -1866,13 +1887,13 @@ msgid "" "types. (Contributed by Sergey B Kirpichev in :gh:`61103`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1231 +#: ../../whatsnew/3.14.rst:1245 msgid "" "Add :func:`ctypes.util.dllist` for listing the shared libraries loaded by " "the current process. (Contributed by Brian Ward in :gh:`119349`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1235 +#: ../../whatsnew/3.14.rst:1249 msgid "" "Move :func:`ctypes.POINTER` types cache from a global internal cache " "(``_pointer_type_cache``) to the :attr:`_CData.__pointer_type__ `. " "(Contributed by Kumar Aditya and Peter Bierma in :gh:`127945`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1251 +#: ../../whatsnew/3.14.rst:1265 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.14.rst:1253 +#: ../../whatsnew/3.14.rst:1267 msgid "" "Add the :func:`~curses.assume_default_colors` function, a refinement of the :" "func:`~curses.use_default_colors` function which allows changing the color " "pair ``0``. (Contributed by Serhiy Storchaka in :gh:`133139`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1260 +#: ../../whatsnew/3.14.rst:1274 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.14.rst:1262 +#: ../../whatsnew/3.14.rst:1276 msgid "" "Add the :meth:`~datetime.date.strptime` method to the :class:`datetime.date` " "and :class:`datetime.time` classes. (Contributed by Wannes Boeykens in :gh:" "`41431`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1268 +#: ../../whatsnew/3.14.rst:1282 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.14.rst:1270 +#: ../../whatsnew/3.14.rst:1284 msgid "" "Add :meth:`.Decimal.from_number` as an alternative constructor for :class:" "`~decimal.Decimal`. (Contributed by Serhiy Storchaka in :gh:`121798`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1274 +#: ../../whatsnew/3.14.rst:1288 msgid "" "Expose :func:`~decimal.IEEEContext` to support creation of contexts " "corresponding to the IEEE 754 (2008) decimal interchange formats. " "(Contributed by Sergey B Kirpichev in :gh:`53032`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1280 ../../whatsnew/3.14.rst:2198 +#: ../../whatsnew/3.14.rst:1294 ../../whatsnew/3.14.rst:2212 msgid "difflib" msgstr "difflib" -#: ../../whatsnew/3.14.rst:1282 +#: ../../whatsnew/3.14.rst:1296 msgid "" "Comparison pages with highlighted changes generated by the :class:`~difflib." "HtmlDiff` class now support 'dark mode'. (Contributed by Jiahao Li in :gh:" "`129939`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1288 +#: ../../whatsnew/3.14.rst:1302 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.14.rst:1290 +#: ../../whatsnew/3.14.rst:1304 msgid "" "Add support for rendering full source location information of :class:" "`instructions `, rather than only the line number. This " @@ -1955,49 +1976,49 @@ msgid "" "keyword argument:" msgstr "" -#: ../../whatsnew/3.14.rst:1295 +#: ../../whatsnew/3.14.rst:1309 msgid ":class:`dis.Bytecode`" msgstr ":class:`dis.Bytecode`" -#: ../../whatsnew/3.14.rst:1296 +#: ../../whatsnew/3.14.rst:1310 msgid ":func:`dis.dis`" msgstr ":func:`dis.dis`" -#: ../../whatsnew/3.14.rst:1297 +#: ../../whatsnew/3.14.rst:1311 msgid ":func:`dis.distb`" msgstr ":func:`dis.distb`" -#: ../../whatsnew/3.14.rst:1298 +#: ../../whatsnew/3.14.rst:1312 msgid ":func:`dis.disassemble`" msgstr ":func:`dis.disassemble`" -#: ../../whatsnew/3.14.rst:1300 +#: ../../whatsnew/3.14.rst:1314 msgid "" "This feature is also exposed via :option:`dis --show-positions`. " "(Contributed by Bénédikt Tran in :gh:`123165`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1303 +#: ../../whatsnew/3.14.rst:1317 msgid "" "Add the :option:`dis --specialized` command-line option to show specialized " "bytecode. (Contributed by Bénédikt Tran in :gh:`127413`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1309 +#: ../../whatsnew/3.14.rst:1323 msgid "errno" msgstr "errno" -#: ../../whatsnew/3.14.rst:1311 +#: ../../whatsnew/3.14.rst:1325 msgid "" "Add the :data:`~errno.EHWPOISON` error code constant. (Contributed by James " "Roy in :gh:`126585`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1316 +#: ../../whatsnew/3.14.rst:1330 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.14.rst:1318 +#: ../../whatsnew/3.14.rst:1332 msgid "" "Add support for printing the C stack trace on systems that :ref:`support it " "` via the new :func:`~faulthandler.dump_c_stack` " @@ -2005,38 +2026,38 @@ msgid "" "(Contributed by Peter Bierma in :gh:`127604`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1326 +#: ../../whatsnew/3.14.rst:1340 msgid "fnmatch" msgstr "fnmatch" -#: ../../whatsnew/3.14.rst:1328 +#: ../../whatsnew/3.14.rst:1342 msgid "" "Add :func:`~fnmatch.filterfalse`, a function to reject names matching a " "given pattern. (Contributed by Bénédikt Tran in :gh:`74598`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1334 +#: ../../whatsnew/3.14.rst:1348 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.14.rst:1336 +#: ../../whatsnew/3.14.rst:1350 msgid "" "A :class:`~fractions.Fraction` object may now be constructed from any object " "with the :meth:`!as_integer_ratio` method. (Contributed by Serhiy Storchaka " "in :gh:`82017`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1340 +#: ../../whatsnew/3.14.rst:1354 msgid "" "Add :meth:`.Fraction.from_number` as an alternative constructor for :class:" "`~fractions.Fraction`. (Contributed by Serhiy Storchaka in :gh:`121797`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1346 +#: ../../whatsnew/3.14.rst:1360 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.14.rst:1348 +#: ../../whatsnew/3.14.rst:1362 msgid "" "Add the :data:`~functools.Placeholder` sentinel. This may be used with the :" "func:`~functools.partial` or :func:`~functools.partialmethod` functions to " @@ -2045,33 +2066,33 @@ msgid "" "`119127`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1355 +#: ../../whatsnew/3.14.rst:1369 msgid "" "Allow the *initial* parameter of :func:`~functools.reduce` to be passed as a " "keyword argument. (Contributed by Sayandip Dutta in :gh:`125916`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1361 +#: ../../whatsnew/3.14.rst:1375 msgid "getopt" msgstr "getopt" -#: ../../whatsnew/3.14.rst:1363 +#: ../../whatsnew/3.14.rst:1377 msgid "" "Add support for options with optional arguments. (Contributed by Serhiy " "Storchaka in :gh:`126374`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1366 +#: ../../whatsnew/3.14.rst:1380 msgid "" "Add support for returning intermixed options and non-option arguments in " "order. (Contributed by Serhiy Storchaka in :gh:`126390`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1371 +#: ../../whatsnew/3.14.rst:1385 msgid "getpass" msgstr "getpass" -#: ../../whatsnew/3.14.rst:1373 +#: ../../whatsnew/3.14.rst:1387 msgid "" "Support keyboard feedback in the :func:`~getpass.getpass` function via the " "keyword-only optional argument *echo_char*. Placeholder characters are " @@ -2079,51 +2100,51 @@ msgid "" "deleted. (Contributed by Semyon Moroz in :gh:`77065`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1381 +#: ../../whatsnew/3.14.rst:1395 msgid "graphlib" msgstr "graphlib" -#: ../../whatsnew/3.14.rst:1383 +#: ../../whatsnew/3.14.rst:1397 msgid "" "Allow :meth:`.TopologicalSorter.prepare` to be called more than once as long " "as sorting has not started. (Contributed by Daniel Pope in :gh:`130914`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1389 +#: ../../whatsnew/3.14.rst:1403 msgid "heapq" msgstr "heapq" -#: ../../whatsnew/3.14.rst:1391 +#: ../../whatsnew/3.14.rst:1405 msgid "" "The :mod:`!heapq` module has improved support for working with max-heaps, " "via the following new functions:" msgstr "" -#: ../../whatsnew/3.14.rst:1394 +#: ../../whatsnew/3.14.rst:1408 msgid ":func:`~heapq.heapify_max`" msgstr ":func:`~heapq.heapify_max`" -#: ../../whatsnew/3.14.rst:1395 +#: ../../whatsnew/3.14.rst:1409 msgid ":func:`~heapq.heappush_max`" msgstr ":func:`~heapq.heappush_max`" -#: ../../whatsnew/3.14.rst:1396 +#: ../../whatsnew/3.14.rst:1410 msgid ":func:`~heapq.heappop_max`" msgstr ":func:`~heapq.heappop_max`" -#: ../../whatsnew/3.14.rst:1397 +#: ../../whatsnew/3.14.rst:1411 msgid ":func:`~heapq.heapreplace_max`" msgstr ":func:`~heapq.heapreplace_max`" -#: ../../whatsnew/3.14.rst:1398 +#: ../../whatsnew/3.14.rst:1412 msgid ":func:`~heapq.heappushpop_max`" msgstr ":func:`~heapq.heappushpop_max`" -#: ../../whatsnew/3.14.rst:1402 +#: ../../whatsnew/3.14.rst:1416 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.14.rst:1404 +#: ../../whatsnew/3.14.rst:1418 msgid "" "Add a built-in implementation for HMAC (:rfc:`2104`) using formally verified " "code from the `HACL* `__ project. " @@ -2131,18 +2152,18 @@ msgid "" "HMAC is not available. (Contributed by Bénédikt Tran in :gh:`99108`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1412 +#: ../../whatsnew/3.14.rst:1426 msgid "http" msgstr "http" -#: ../../whatsnew/3.14.rst:1414 +#: ../../whatsnew/3.14.rst:1428 msgid "" "Directory lists and error pages generated by the :mod:`http.server` module " "allow the browser to apply its default dark mode. (Contributed by Yorik " "Hansen in :gh:`123430`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1418 +#: ../../whatsnew/3.14.rst:1432 msgid "" "The :mod:`http.server` module now supports serving over HTTPS using the :" "class:`http.server.HTTPSServer` class. This functionality is exposed by the " @@ -2150,74 +2171,74 @@ msgid "" "options:" msgstr "" -#: ../../whatsnew/3.14.rst:1423 +#: ../../whatsnew/3.14.rst:1437 msgid "" ":option:`--tls-cert \\ `: Path to the TLS " "certificate file." msgstr "" -#: ../../whatsnew/3.14.rst:1425 +#: ../../whatsnew/3.14.rst:1439 msgid "" ":option:`--tls-key \\ `: Optional path to the " "private key file." msgstr "" -#: ../../whatsnew/3.14.rst:1427 +#: ../../whatsnew/3.14.rst:1441 msgid "" ":option:`--tls-password-file \\ `: " "Optional path to the password file for the private key." msgstr "" -#: ../../whatsnew/3.14.rst:1430 +#: ../../whatsnew/3.14.rst:1444 msgid "(Contributed by Semyon Moroz in :gh:`85162`.)" msgstr "(由 Semyon Moroz 於 :gh:`85162` 貢獻。)" -#: ../../whatsnew/3.14.rst:1434 +#: ../../whatsnew/3.14.rst:1448 msgid "imaplib" msgstr "imaplib" -#: ../../whatsnew/3.14.rst:1436 +#: ../../whatsnew/3.14.rst:1450 msgid "" "Add :meth:`.IMAP4.idle`, implementing the IMAP4 ``IDLE`` command as defined " "in :rfc:`2177`. (Contributed by Forest in :gh:`55454`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1442 +#: ../../whatsnew/3.14.rst:1456 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.14.rst:1444 +#: ../../whatsnew/3.14.rst:1458 msgid "" ":func:`~inspect.signature` takes a new argument *annotation_format* to " "control the :class:`annotationlib.Format` used for representing annotations. " "(Contributed by Jelle Zijlstra in :gh:`101552`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1448 +#: ../../whatsnew/3.14.rst:1462 msgid "" ":meth:`.Signature.format` takes a new argument *unquote_annotations*. If " "true, string :term:`annotations ` are displayed without " "surrounding quotes. (Contributed by Jelle Zijlstra in :gh:`101552`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1453 +#: ../../whatsnew/3.14.rst:1467 msgid "" "Add function :func:`~inspect.ispackage` to determine whether an object is a :" "term:`package` or not. (Contributed by Zhikang Yan in :gh:`125634`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1459 ../../whatsnew/3.14.rst:2240 +#: ../../whatsnew/3.14.rst:1473 ../../whatsnew/3.14.rst:2265 msgid "io" msgstr "io" -#: ../../whatsnew/3.14.rst:1461 +#: ../../whatsnew/3.14.rst:1475 msgid "" "Reading text from a non-blocking stream with ``read`` may now raise a :exc:" "`BlockingIOError` if the operation cannot immediately return bytes. " "(Contributed by Giovanni Siragusa in :gh:`109523`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1465 +#: ../../whatsnew/3.14.rst:1479 msgid "" "Add the :class:`~io.Reader` and :class:`~io.Writer` protocols as simpler " "alternatives to the pseudo-protocols :class:`typing.IO`, :class:`typing." @@ -2225,17 +2246,17 @@ msgid "" "gh:`127648`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1472 +#: ../../whatsnew/3.14.rst:1486 msgid "json" msgstr "json" -#: ../../whatsnew/3.14.rst:1474 +#: ../../whatsnew/3.14.rst:1488 msgid "" "Add exception notes for JSON serialization errors that allow identifying the " "source of the error. (Contributed by Serhiy Storchaka in :gh:`122163`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1478 +#: ../../whatsnew/3.14.rst:1492 msgid "" "Allow using the :mod:`json` module as a script using the :option:`-m` " "switch: :program:`python -m json`. This is now preferred to :program:`python " @@ -2244,7 +2265,7 @@ msgid "" "Hunner in :gh:`122873`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1485 +#: ../../whatsnew/3.14.rst:1499 msgid "" "By default, the output of the :ref:`JSON command-line interface ` is highlighted in color. This can be controlled by :ref:" @@ -2252,56 +2273,56 @@ msgid "" "Roun in :gh:`131952`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1493 +#: ../../whatsnew/3.14.rst:1507 msgid "linecache" msgstr "linecache" -#: ../../whatsnew/3.14.rst:1495 +#: ../../whatsnew/3.14.rst:1509 msgid "" ":func:`~linecache.getline` can now retrieve source code for frozen modules. " "(Contributed by Tian Gao in :gh:`131638`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1500 +#: ../../whatsnew/3.14.rst:1514 msgid "logging.handlers" msgstr "logging.handlers" -#: ../../whatsnew/3.14.rst:1502 +#: ../../whatsnew/3.14.rst:1516 msgid "" ":class:`~logging.handlers.QueueListener` objects now support the :term:" "`context manager` protocol. (Contributed by Charles Machalow in :gh:" "`132106`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1506 +#: ../../whatsnew/3.14.rst:1520 msgid "" ":meth:`QueueListener.start ` now " "raises a :exc:`RuntimeError` if the listener is already started. " "(Contributed by Charles Machalow in :gh:`132106`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1512 +#: ../../whatsnew/3.14.rst:1526 msgid "math" msgstr "math" -#: ../../whatsnew/3.14.rst:1514 +#: ../../whatsnew/3.14.rst:1528 msgid "" "Added more detailed error messages for domain errors in the module. " "(Contributed by Charlie Zhao and Sergey B Kirpichev in :gh:`101410`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1519 +#: ../../whatsnew/3.14.rst:1533 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.14.rst:1521 +#: ../../whatsnew/3.14.rst:1535 msgid "" "Add a public :ref:`command-line ` for the module, invoked " "via :program:`python -m mimetypes`. (Contributed by Oleg Iarygin and Hugo " "van Kemenade in :gh:`93096`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1525 +#: ../../whatsnew/3.14.rst:1539 msgid "Add several new MIME types based on RFCs and common usage:" msgstr "" @@ -2309,23 +2330,23 @@ msgstr "" msgid "Microsoft and :rfc:`8081` MIME types for fonts" msgstr "" -#: ../../whatsnew/3.14.rst:1529 +#: ../../whatsnew/3.14.rst:1543 msgid "Embedded OpenType: ``application/vnd.ms-fontobject``" msgstr "" -#: ../../whatsnew/3.14.rst:1530 +#: ../../whatsnew/3.14.rst:1544 msgid "OpenType Layout (OTF) ``font/otf``" msgstr "" -#: ../../whatsnew/3.14.rst:1531 +#: ../../whatsnew/3.14.rst:1545 msgid "TrueType: ``font/ttf``" msgstr "" -#: ../../whatsnew/3.14.rst:1532 +#: ../../whatsnew/3.14.rst:1546 msgid "WOFF 1.0 ``font/woff``" msgstr "WOFF 1.0 ``font/woff``" -#: ../../whatsnew/3.14.rst:1533 +#: ../../whatsnew/3.14.rst:1547 msgid "WOFF 2.0 ``font/woff2``" msgstr "WOFF 2.0 ``font/woff2``" @@ -2334,15 +2355,15 @@ msgid "" ":rfc:`9559` MIME types for Matroska audiovisual data container structures" msgstr "" -#: ../../whatsnew/3.14.rst:1538 +#: ../../whatsnew/3.14.rst:1552 msgid "audio with no video: ``audio/matroska`` (``.mka``)" msgstr "" -#: ../../whatsnew/3.14.rst:1539 +#: ../../whatsnew/3.14.rst:1553 msgid "video: ``video/matroska`` (``.mkv``)" msgstr "" -#: ../../whatsnew/3.14.rst:1540 +#: ../../whatsnew/3.14.rst:1554 msgid "stereoscopic video: ``video/matroska-3d`` (``.mk3d``)" msgstr "" @@ -2350,29 +2371,29 @@ msgstr "" msgid "Images with RFCs" msgstr "" -#: ../../whatsnew/3.14.rst:1544 +#: ../../whatsnew/3.14.rst:1558 msgid ":rfc:`1494`: CCITT Group 3 (``.g3``)" msgstr ":rfc:`1494`: CCITT Group 3 (``.g3``)" -#: ../../whatsnew/3.14.rst:1545 +#: ../../whatsnew/3.14.rst:1559 msgid ":rfc:`3362`: Real-time Facsimile, T.38 (``.t38``)" msgstr "" -#: ../../whatsnew/3.14.rst:1546 +#: ../../whatsnew/3.14.rst:1560 msgid "" ":rfc:`3745`: JPEG 2000 (``.jp2``), extension (``.jpx``) and compound (``." "jpm``)" msgstr "" -#: ../../whatsnew/3.14.rst:1547 +#: ../../whatsnew/3.14.rst:1561 msgid ":rfc:`3950`: Tag Image File Format Fax eXtended, TIFF-FX (``.tfx``)" msgstr "" -#: ../../whatsnew/3.14.rst:1548 +#: ../../whatsnew/3.14.rst:1562 msgid ":rfc:`4047`: Flexible Image Transport System (``.fits``)" msgstr "" -#: ../../whatsnew/3.14.rst:1549 +#: ../../whatsnew/3.14.rst:1563 msgid "" ":rfc:`7903`: Enhanced Metafile (``.emf``) and Windows Metafile (``.wmf``)" msgstr "" @@ -2381,115 +2402,115 @@ msgstr "" msgid "Other MIME type additions and changes" msgstr "" -#: ../../whatsnew/3.14.rst:1553 +#: ../../whatsnew/3.14.rst:1567 msgid "" ":rfc:`2361`: Change type for ``.avi`` to ``video/vnd.avi`` and for ``.wav`` " "to ``audio/vnd.wave``" msgstr "" -#: ../../whatsnew/3.14.rst:1555 +#: ../../whatsnew/3.14.rst:1569 msgid ":rfc:`4337`: Add MPEG-4 ``audio/mp4`` (``.m4a``)" msgstr "" -#: ../../whatsnew/3.14.rst:1556 +#: ../../whatsnew/3.14.rst:1570 msgid ":rfc:`5334`: Add Ogg media (``.oga``, ``.ogg`` and ``.ogx``)" msgstr "" -#: ../../whatsnew/3.14.rst:1557 +#: ../../whatsnew/3.14.rst:1571 msgid ":rfc:`6713`: Add gzip ``application/gzip`` (``.gz``)" msgstr "" -#: ../../whatsnew/3.14.rst:1558 +#: ../../whatsnew/3.14.rst:1572 msgid ":rfc:`9639`: Add FLAC ``audio/flac`` (``.flac``)" msgstr "" -#: ../../whatsnew/3.14.rst:1559 +#: ../../whatsnew/3.14.rst:1573 msgid "" ":rfc:`9512` ``application/yaml`` MIME type for YAML files (``.yaml`` and ``." "yml``)" msgstr "" -#: ../../whatsnew/3.14.rst:1561 +#: ../../whatsnew/3.14.rst:1575 msgid "Add 7z ``application/x-7z-compressed`` (``.7z``)" msgstr "" -#: ../../whatsnew/3.14.rst:1562 +#: ../../whatsnew/3.14.rst:1576 msgid "" "Add Android Package ``application/vnd.android.package-archive`` (``.apk``) " "when not strict" msgstr "" -#: ../../whatsnew/3.14.rst:1564 +#: ../../whatsnew/3.14.rst:1578 msgid "Add deb ``application/x-debian-package`` (``.deb``)" msgstr "" -#: ../../whatsnew/3.14.rst:1565 +#: ../../whatsnew/3.14.rst:1579 msgid "Add glTF binary ``model/gltf-binary`` (``.glb``)" msgstr "" -#: ../../whatsnew/3.14.rst:1566 +#: ../../whatsnew/3.14.rst:1580 msgid "Add glTF JSON/ASCII ``model/gltf+json`` (``.gltf``)" msgstr "" -#: ../../whatsnew/3.14.rst:1567 +#: ../../whatsnew/3.14.rst:1581 msgid "Add M4V ``video/x-m4v`` (``.m4v``)" msgstr "" -#: ../../whatsnew/3.14.rst:1568 +#: ../../whatsnew/3.14.rst:1582 msgid "Add PHP ``application/x-httpd-php`` (``.php``)" msgstr "" -#: ../../whatsnew/3.14.rst:1569 +#: ../../whatsnew/3.14.rst:1583 msgid "Add RAR ``application/vnd.rar`` (``.rar``)" msgstr "" -#: ../../whatsnew/3.14.rst:1570 +#: ../../whatsnew/3.14.rst:1584 msgid "Add RPM ``application/x-rpm`` (``.rpm``)" msgstr "" -#: ../../whatsnew/3.14.rst:1571 +#: ../../whatsnew/3.14.rst:1585 msgid "Add STL ``model/stl`` (``.stl``)" msgstr "" -#: ../../whatsnew/3.14.rst:1572 +#: ../../whatsnew/3.14.rst:1586 msgid "Add Windows Media Video ``video/x-ms-wmv`` (``.wmv``)" msgstr "" -#: ../../whatsnew/3.14.rst:1573 +#: ../../whatsnew/3.14.rst:1587 msgid "De facto: Add WebM ``audio/webm`` (``.weba``)" msgstr "" -#: ../../whatsnew/3.14.rst:1574 +#: ../../whatsnew/3.14.rst:1588 msgid "" "`ECMA-376 `__: Add ``.docx``, ``.pptx`` and ``.xlsx`` types" msgstr "" -#: ../../whatsnew/3.14.rst:1577 +#: ../../whatsnew/3.14.rst:1591 msgid "" "`OASIS `__: Add OpenDocument ``.odg``, ``.odp``, ``.ods`` and " "``.odt`` types" msgstr "" -#: ../../whatsnew/3.14.rst:1580 +#: ../../whatsnew/3.14.rst:1594 msgid "" "`W3C `__: Add EPUB " "``application/epub+zip`` (``.epub``)" msgstr "" -#: ../../whatsnew/3.14.rst:1583 +#: ../../whatsnew/3.14.rst:1597 msgid "" "(Contributed by Sahil Prajapati and Hugo van Kemenade in :gh:`84852`, by " "Sasha \"Nelie\" Chernykh and Hugo van Kemenade in :gh:`132056`, and by Hugo " "van Kemenade in :gh:`89416`, :gh:`85957`, and :gh:`129965`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1589 +#: ../../whatsnew/3.14.rst:1603 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.14.rst:1593 +#: ../../whatsnew/3.14.rst:1607 msgid "" "On Unix platforms other than macOS, :ref:`'forkserver' ` is now the default :ref:`start method " @@ -2499,7 +2520,7 @@ msgid "" "method." msgstr "" -#: ../../whatsnew/3.14.rst:1600 +#: ../../whatsnew/3.14.rst:1614 msgid "" "If the threading incompatible *fork* method is required, you must explicitly " "request it via a context from :func:`~multiprocessing.get_context` " @@ -2507,7 +2528,7 @@ msgid "" "set_start_method`." msgstr "" -#: ../../whatsnew/3.14.rst:1611 +#: ../../whatsnew/3.14.rst:1625 msgid "" ":mod:`multiprocessing`'s ``'forkserver'`` start method now authenticates its " "control socket to avoid solely relying on filesystem permissions to restrict " @@ -2515,34 +2536,34 @@ msgid "" "code. (Contributed by Gregory P. Smith for :gh:`97514`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1617 +#: ../../whatsnew/3.14.rst:1631 msgid "" "The :ref:`multiprocessing proxy objects ` for " "*list* and *dict* types gain previously overlooked missing methods:" msgstr "" -#: ../../whatsnew/3.14.rst:1620 +#: ../../whatsnew/3.14.rst:1634 msgid ":meth:`!clear` and :meth:`!copy` for proxies of :class:`list`" msgstr "" -#: ../../whatsnew/3.14.rst:1621 +#: ../../whatsnew/3.14.rst:1635 msgid "" ":meth:`~dict.fromkeys`, ``reversed(d)``, ``d | {}``, ``{} | d``, ``d |= " "{'b': 2}`` for proxies of :class:`dict`" msgstr "" -#: ../../whatsnew/3.14.rst:1624 +#: ../../whatsnew/3.14.rst:1638 msgid "(Contributed by Roy Hyunjin Han for :gh:`103134`.)" msgstr "(由 Roy Hyunjin Han 於 :gh:`103134` 貢獻。)" -#: ../../whatsnew/3.14.rst:1626 +#: ../../whatsnew/3.14.rst:1640 msgid "" "Add support for shared :class:`set` objects via :meth:`.SyncManager.set`. " "The :func:`set` in :func:`~multiprocessing.Manager` method is now available. " "(Contributed by Mingyu Park in :gh:`129949`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1631 +#: ../../whatsnew/3.14.rst:1645 msgid "" "Add the :meth:`~multiprocessing.Process.interrupt` to :class:" "`multiprocessing.Process` objects, which terminates the child process by " @@ -2551,11 +2572,11 @@ msgid "" "Pulkin in :gh:`131913`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1639 +#: ../../whatsnew/3.14.rst:1653 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.14.rst:1641 +#: ../../whatsnew/3.14.rst:1655 msgid "" "Add :func:`~operator.is_none` and :func:`~operator.is_not_none` as a pair of " "functions, such that ``operator.is_none(obj)`` is equivalent to ``obj is " @@ -2563,11 +2584,11 @@ msgid "" "None``. (Contributed by Raymond Hettinger and Nico Mexis in :gh:`115808`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1649 +#: ../../whatsnew/3.14.rst:1663 msgid "os" msgstr "os" -#: ../../whatsnew/3.14.rst:1651 +#: ../../whatsnew/3.14.rst:1665 msgid "" "Add the :func:`~os.reload_environ` function to update :data:`os.environ` " "and :data:`os.environb` with changes to the environment made by :func:`os." @@ -2575,24 +2596,24 @@ msgid "" "(Contributed by Victor Stinner in :gh:`120057`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1657 +#: ../../whatsnew/3.14.rst:1671 msgid "" "Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants to " "the :mod:`!os` module. (Contributed by James Roy in :gh:`127688`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1661 +#: ../../whatsnew/3.14.rst:1675 msgid "" "Add the :func:`~os.readinto` function to read into a :ref:`buffer object " "` from a file descriptor. (Contributed by Cody Maloney in :gh:" "`129205`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1667 +#: ../../whatsnew/3.14.rst:1681 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.14.rst:1669 +#: ../../whatsnew/3.14.rst:1683 msgid "" "The *strict* parameter to :func:`~os.path.realpath` accepts a new value, :" "data:`~os.path.ALLOW_MISSING`. If used, errors other than :exc:" @@ -2601,40 +2622,40 @@ msgid "" "`2025-4517`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1677 ../../whatsnew/3.14.rst:2249 -#: ../../whatsnew/3.14.rst:2510 +#: ../../whatsnew/3.14.rst:1691 ../../whatsnew/3.14.rst:2274 +#: ../../whatsnew/3.14.rst:2535 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.14.rst:1679 +#: ../../whatsnew/3.14.rst:1693 msgid "" "Add methods to :class:`pathlib.Path` to recursively copy or move files and " "directories:" msgstr "" -#: ../../whatsnew/3.14.rst:1682 +#: ../../whatsnew/3.14.rst:1696 msgid "" ":meth:`~pathlib.Path.copy` copies a file or directory tree to a destination." msgstr "" -#: ../../whatsnew/3.14.rst:1683 +#: ../../whatsnew/3.14.rst:1697 msgid ":meth:`~pathlib.Path.copy_into` copies *into* a destination directory." msgstr "" -#: ../../whatsnew/3.14.rst:1684 +#: ../../whatsnew/3.14.rst:1698 msgid "" ":meth:`~pathlib.Path.move` moves a file or directory tree to a destination." msgstr "" -#: ../../whatsnew/3.14.rst:1685 +#: ../../whatsnew/3.14.rst:1699 msgid ":meth:`~pathlib.Path.move_into` moves *into* a destination directory." msgstr "" -#: ../../whatsnew/3.14.rst:1687 +#: ../../whatsnew/3.14.rst:1701 msgid "(Contributed by Barney Gale in :gh:`73991`.)" msgstr "(由 Barney Gale 於 :gh:`73991` 貢獻。)" -#: ../../whatsnew/3.14.rst:1689 +#: ../../whatsnew/3.14.rst:1703 msgid "" "Add the :attr:`~pathlib.Path.info` attribute, which stores an object " "implementing the new :class:`pathlib.types.PathInfo` protocol. The object " @@ -2644,21 +2665,21 @@ msgid "" "directory. (Contributed by Barney Gale in :gh:`125413`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1699 ../../whatsnew/3.14.rst:2257 +#: ../../whatsnew/3.14.rst:1713 ../../whatsnew/3.14.rst:2282 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.14.rst:1701 +#: ../../whatsnew/3.14.rst:1715 msgid "" "The :mod:`pdb` module now supports remote attaching to a running Python " "process using a new :option:`-p PID ` command-line option:" msgstr "" -#: ../../whatsnew/3.14.rst:1704 +#: ../../whatsnew/3.14.rst:1718 msgid "python -m pdb -p 1234" msgstr "python -m pdb -p 1234" -#: ../../whatsnew/3.14.rst:1708 +#: ../../whatsnew/3.14.rst:1722 msgid "" "This will connect to the Python process with the given PID and allow you to " "debug it interactively. Notice that due to how the Python interpreter works " @@ -2667,18 +2688,18 @@ msgid "" "when the process receives a signal." msgstr "" -#: ../../whatsnew/3.14.rst:1714 +#: ../../whatsnew/3.14.rst:1728 msgid "" "This feature uses :ref:`PEP 768 ` and the new :" "func:`sys.remote_exec` function to attach to the remote process and send the " "PDB commands to it." msgstr "" -#: ../../whatsnew/3.14.rst:1718 +#: ../../whatsnew/3.14.rst:1732 msgid "(Contributed by Matt Wozniski and Pablo Galindo in :gh:`131591`.)" msgstr "(由 Matt Wozniski and Pablo Galindo 於 :gh:`131591` 貢獻。)" -#: ../../whatsnew/3.14.rst:1720 +#: ../../whatsnew/3.14.rst:1734 msgid "" "Hardcoded breakpoints (:func:`breakpoint` and :func:`~pdb.set_trace`) now " "reuse the most recent :class:`~pdb.Pdb` instance that calls :meth:`~pdb.Pdb." @@ -2688,14 +2709,14 @@ msgid "" "`121450`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1727 +#: ../../whatsnew/3.14.rst:1741 msgid "" "Add a new argument *mode* to :class:`pdb.Pdb`. Disable the ``restart`` " "command when :mod:`pdb` is in ``inline`` mode. (Contributed by Tian Gao in :" "gh:`123757`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1731 +#: ../../whatsnew/3.14.rst:1745 msgid "" "A confirmation prompt will be shown when the user tries to quit :mod:`pdb` " "in ``inline`` mode. ``y``, ``Y``, ```` or ``EOF`` will confirm the " @@ -2703,41 +2724,41 @@ msgid "" "(Contributed by Tian Gao in :gh:`124704`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1736 +#: ../../whatsnew/3.14.rst:1750 msgid "" "Inline breakpoints like :func:`breakpoint` or :func:`pdb.set_trace` will " "always stop the program at calling frame, ignoring the ``skip`` pattern (if " "any). (Contributed by Tian Gao in :gh:`130493`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1741 +#: ../../whatsnew/3.14.rst:1755 msgid "" "```` at the beginning of the line in :mod:`pdb` multi-line input will " "fill in a 4-space indentation now, instead of inserting a ``\\t`` character. " "(Contributed by Tian Gao in :gh:`130471`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1745 +#: ../../whatsnew/3.14.rst:1759 msgid "" "Auto-indent is introduced in :mod:`pdb` multi-line input. It will either " "keep the indentation of the last line or insert a 4-space indentation when " "it detects a new code block. (Contributed by Tian Gao in :gh:`133350`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1750 +#: ../../whatsnew/3.14.rst:1764 msgid "" "``$_asynctask`` is added to access the current asyncio task if applicable. " "(Contributed by Tian Gao in :gh:`124367`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1753 +#: ../../whatsnew/3.14.rst:1767 msgid "" ":func:`pdb.set_trace_async` is added to support debugging asyncio " "coroutines. :keyword:`await` statements are supported with this function. " "(Contributed by Tian Gao in :gh:`132576`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1758 +#: ../../whatsnew/3.14.rst:1772 msgid "" "Source code displayed in :mod:`pdb` will be syntax-highlighted. This feature " "can be controlled using the same methods as the default :term:`interactive` " @@ -2745,49 +2766,49 @@ msgid "" "Pdb`. (Contributed by Tian Gao and Łukasz Langa in :gh:`133355`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1765 +#: ../../whatsnew/3.14.rst:1779 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.14.rst:1767 +#: ../../whatsnew/3.14.rst:1781 msgid "" "Set the default protocol version on the :mod:`pickle` module to 5. For more " "details, see :ref:`pickle protocols `." msgstr "" -#: ../../whatsnew/3.14.rst:1770 +#: ../../whatsnew/3.14.rst:1784 msgid "" "Add exception notes for pickle serialization errors that allow identifying " "the source of the error. (Contributed by Serhiy Storchaka in :gh:`122213`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1776 +#: ../../whatsnew/3.14.rst:1790 msgid "platform" msgstr "platform" -#: ../../whatsnew/3.14.rst:1778 +#: ../../whatsnew/3.14.rst:1792 msgid "" "Add :func:`~platform.invalidate_caches`, a function to invalidate cached " "results in the :mod:`!platform` module. (Contributed by Bénédikt Tran in :gh:" "`122549`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1784 +#: ../../whatsnew/3.14.rst:1798 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.14.rst:1786 +#: ../../whatsnew/3.14.rst:1800 msgid "" ":term:`Annotations ` in help output are now usually displayed in " "a format closer to that in the original source. (Contributed by Jelle " "Zijlstra in :gh:`101552`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1792 +#: ../../whatsnew/3.14.rst:1806 msgid "re" msgstr "re" -#: ../../whatsnew/3.14.rst:1794 +#: ../../whatsnew/3.14.rst:1808 msgid "" "Support ``\\z`` as a synonym for ``\\Z`` in :mod:`regular expressions `. " "It is interpreted unambiguously in many other regular expression engines, " @@ -2795,119 +2816,119 @@ msgid "" "Storchaka in :gh:`133306`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1799 +#: ../../whatsnew/3.14.rst:1813 msgid "" "``\\B`` in :mod:`regular expression ` now matches the empty input " "string, meaning that it is now always the opposite of ``\\b``. (Contributed " "by Serhiy Storchaka in :gh:`124130`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1805 +#: ../../whatsnew/3.14.rst:1819 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.14.rst:1807 +#: ../../whatsnew/3.14.rst:1821 msgid "Improve and fix support for Bluetooth sockets." msgstr "" -#: ../../whatsnew/3.14.rst:1809 +#: ../../whatsnew/3.14.rst:1823 msgid "" "Fix support of Bluetooth sockets on NetBSD and DragonFly BSD. (Contributed " "by Serhiy Storchaka in :gh:`132429`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1811 +#: ../../whatsnew/3.14.rst:1825 msgid "" "Fix support for :const:`~socket.BTPROTO_HCI` on FreeBSD. (Contributed by " "Victor Stinner in :gh:`111178`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1813 +#: ../../whatsnew/3.14.rst:1827 msgid "" "Add support for :const:`~socket.BTPROTO_SCO` on FreeBSD. (Contributed by " "Serhiy Storchaka in :gh:`85302`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1815 +#: ../../whatsnew/3.14.rst:1829 msgid "" "Add support for *cid* and *bdaddr_type* in the address for :const:`~socket." "BTPROTO_L2CAP` on FreeBSD. (Contributed by Serhiy Storchaka in :gh:`132429`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1818 +#: ../../whatsnew/3.14.rst:1832 msgid "" "Add support for *channel* in the address for :const:`~socket.BTPROTO_HCI` on " "Linux. (Contributed by Serhiy Storchaka in :gh:`70145`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1821 +#: ../../whatsnew/3.14.rst:1835 msgid "" "Accept an integer as the address for :const:`~socket.BTPROTO_HCI` on Linux. " "(Contributed by Serhiy Storchaka in :gh:`132099`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1824 +#: ../../whatsnew/3.14.rst:1838 msgid "" "Return *cid* in :meth:`~socket.socket.getsockname` for :const:`~socket." "BTPROTO_L2CAP`. (Contributed by Serhiy Storchaka in :gh:`132429`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1827 +#: ../../whatsnew/3.14.rst:1841 msgid "" "Add many new constants. (Contributed by Serhiy Storchaka in :gh:`132734`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1832 +#: ../../whatsnew/3.14.rst:1846 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.14.rst:1834 +#: ../../whatsnew/3.14.rst:1848 msgid "" "Indicate through the :data:`~ssl.HAS_PHA` Boolean whether the :mod:`!ssl` " "module supports TLSv1.3 post-handshake client authentication (PHA). " "(Contributed by Will Childs-Klein in :gh:`128036`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1840 +#: ../../whatsnew/3.14.rst:1854 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.14.rst:1842 +#: ../../whatsnew/3.14.rst:1856 msgid "" "Support the :c:expr:`float complex` and :c:expr:`double complex` C types in " "the :mod:`struct` module (formatting characters ``'F'`` and ``'D'`` " "respectively). (Contributed by Sergey B Kirpichev in :gh:`121249`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1849 +#: ../../whatsnew/3.14.rst:1863 msgid "symtable" msgstr "symtable" -#: ../../whatsnew/3.14.rst:1851 +#: ../../whatsnew/3.14.rst:1865 msgid "Expose the following :class:`~symtable.Symbol` methods:" msgstr "" -#: ../../whatsnew/3.14.rst:1853 +#: ../../whatsnew/3.14.rst:1867 msgid ":meth:`~symtable.Symbol.is_comp_cell`" msgstr ":meth:`~symtable.Symbol.is_comp_cell`" -#: ../../whatsnew/3.14.rst:1854 +#: ../../whatsnew/3.14.rst:1868 msgid ":meth:`~symtable.Symbol.is_comp_iter`" msgstr ":meth:`~symtable.Symbol.is_comp_iter`" -#: ../../whatsnew/3.14.rst:1855 +#: ../../whatsnew/3.14.rst:1869 msgid ":meth:`~symtable.Symbol.is_free_class`" msgstr ":meth:`~symtable.Symbol.is_free_class`" -#: ../../whatsnew/3.14.rst:1857 +#: ../../whatsnew/3.14.rst:1871 msgid "(Contributed by Bénédikt Tran in :gh:`120029`.)" msgstr "(由 Bénédikt Tran 於 :gh:`120029` 貢獻。)" -#: ../../whatsnew/3.14.rst:1861 +#: ../../whatsnew/3.14.rst:1875 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.14.rst:1863 +#: ../../whatsnew/3.14.rst:1877 msgid "" "The previously undocumented special function :func:`sys.getobjects`, which " "only exists in specialized builds of Python, may now return objects from " @@ -2915,26 +2936,26 @@ msgid "" "in :gh:`125286`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1868 +#: ../../whatsnew/3.14.rst:1882 msgid "" "Add :func:`sys._is_immortal` for determining if an object is :term:" "`immortal`. (Contributed by Peter Bierma in :gh:`128509`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1871 +#: ../../whatsnew/3.14.rst:1885 msgid "" "On FreeBSD, :data:`sys.platform` no longer contains the major version " "number. It is always ``'freebsd'``, instead of ``'freebsd13'`` or " "``'freebsd14'``. (Contributed by Michael Osipov in :gh:`129393`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1875 +#: ../../whatsnew/3.14.rst:1889 msgid "" "Raise :exc:`DeprecationWarning` for :func:`sys._clear_type_cache`. This " "function was deprecated in Python 3.13 but it didn't raise a runtime warning." msgstr "" -#: ../../whatsnew/3.14.rst:1878 +#: ../../whatsnew/3.14.rst:1892 msgid "" "Add :func:`sys.remote_exec` to implement the new external debugger " "interface. See :ref:`PEP 768 ` for details. " @@ -2942,52 +2963,52 @@ msgid "" "in :gh:`131591`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1883 +#: ../../whatsnew/3.14.rst:1897 msgid "" "Add the :data:`sys._jit` namespace, containing utilities for introspecting " "just-in-time compilation. (Contributed by Brandt Bucher in :gh:`133231`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1889 +#: ../../whatsnew/3.14.rst:1903 msgid "sys.monitoring" msgstr "sys.monitoring" -#: ../../whatsnew/3.14.rst:1891 +#: ../../whatsnew/3.14.rst:1905 msgid "" "Add two new monitoring events, :monitoring-event:`BRANCH_LEFT` and :" "monitoring-event:`BRANCH_RIGHT`. These replace and deprecate the :monitoring-" "event:`!BRANCH` event. (Contributed by Mark Shannon in :gh:`122548`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1898 +#: ../../whatsnew/3.14.rst:1912 msgid "sysconfig" msgstr "sysconfig" -#: ../../whatsnew/3.14.rst:1900 +#: ../../whatsnew/3.14.rst:1914 msgid "" "Add ``ABIFLAGS`` key to :func:`~sysconfig.get_config_vars` on Windows. " "(Contributed by Xuehai Pan in :gh:`131799`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1905 +#: ../../whatsnew/3.14.rst:1919 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.14.rst:1907 +#: ../../whatsnew/3.14.rst:1921 msgid "" ":func:`~tarfile.data_filter` now normalizes symbolic link targets in order " "to avoid path traversal attacks. (Contributed by Petr Viktorin in :gh:" "`127987` and :cve:`2025-4138`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1911 +#: ../../whatsnew/3.14.rst:1925 msgid "" ":func:`~tarfile.TarFile.extractall` now skips fixing up directory attributes " "when a directory was removed or replaced by another kind of file. " "(Contributed by Petr Viktorin in :gh:`127987` and :cve:`2024-12718`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1915 +#: ../../whatsnew/3.14.rst:1929 msgid "" ":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` now " "(re-)apply the extraction filter when substituting a link (hard or symbolic) " @@ -2997,7 +3018,7 @@ msgid "" "cve:`2024-12718`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1922 +#: ../../whatsnew/3.14.rst:1936 msgid "" ":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` no " "longer extract rejected members when :func:`~tarfile.TarFile.errorlevel` is " @@ -3005,59 +3026,59 @@ msgid "" "cve:`2025-4435`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1930 +#: ../../whatsnew/3.14.rst:1944 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.14.rst:1932 +#: ../../whatsnew/3.14.rst:1946 msgid "" ":meth:`threading.Thread.start` now sets the operating system thread name to :" "attr:`threading.Thread.name`. (Contributed by Victor Stinner in :gh:`59705`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1938 +#: ../../whatsnew/3.14.rst:1952 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.14.rst:1940 +#: ../../whatsnew/3.14.rst:1954 msgid "" "Make :mod:`tkinter` widget methods :meth:`!after` and :meth:`!after_idle` " "accept keyword arguments. (Contributed by Zhikang Yan in :gh:`126899`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1944 +#: ../../whatsnew/3.14.rst:1958 msgid "" "Add ability to specify a name for :class:`!tkinter.OptionMenu` and :class:`!" "tkinter.ttk.OptionMenu`. (Contributed by Zhikang Yan in :gh:`130482`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1950 +#: ../../whatsnew/3.14.rst:1964 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.14.rst:1952 +#: ../../whatsnew/3.14.rst:1966 msgid "" "Add context managers for :func:`turtle.fill`, :func:`turtle.poly`, and :func:" "`turtle.no_animation`. (Contributed by Marie Roald and Yngve Mardal Moe in :" "gh:`126350`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1958 +#: ../../whatsnew/3.14.rst:1972 msgid "types" msgstr "types" -#: ../../whatsnew/3.14.rst:1960 +#: ../../whatsnew/3.14.rst:1974 msgid "" ":class:`types.UnionType` is now an alias for :class:`typing.Union`. See :ref:" "`below ` for more details. (Contributed by Jelle " "Zijlstra in :gh:`105499`.)" msgstr "" -#: ../../whatsnew/3.14.rst:1966 +#: ../../whatsnew/3.14.rst:1980 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.14.rst:1970 +#: ../../whatsnew/3.14.rst:1984 msgid "" "The :class:`types.UnionType` and :class:`typing.Union` types are now aliases " "for each other, meaning that both old-style unions (created with " @@ -3067,14 +3088,14 @@ msgid "" "users who introspect types at runtime:" msgstr "" -#: ../../whatsnew/3.14.rst:1977 +#: ../../whatsnew/3.14.rst:1991 msgid "" "Both syntaxes for creating a union now produce the same string " "representation in :func:`repr`. For example, ``repr(Union[int, str])`` is " "now ``\"int | str\"`` instead of ``\"typing.Union[int, str]\"``." msgstr "" -#: ../../whatsnew/3.14.rst:1982 +#: ../../whatsnew/3.14.rst:1996 msgid "" "Unions created using the old syntax are no longer cached. Previously, " "running ``Union[int, str]`` multiple times would return the same object " @@ -3091,7 +3112,7 @@ msgid "" "memory usage for most users." msgstr "" -#: ../../whatsnew/3.14.rst:1998 +#: ../../whatsnew/3.14.rst:2012 msgid "" "Previously, old-style unions were implemented using the private class " "``typing._UnionGenericAlias``. This class is no longer needed for the " @@ -3105,80 +3126,80 @@ msgstr "" "改用文件中記錄的自我檢查輔助函式,例如 :func:`~typing.get_origin` 和 :func:" "`typing.get_args`,或者依賴私有實作細節。" -#: ../../whatsnew/3.14.rst:2007 +#: ../../whatsnew/3.14.rst:2021 msgid "" "It is now possible to use :class:`typing.Union` itself in :func:`isinstance` " "checks. For example, ``isinstance(int | str, typing.Union)`` will return " "``True``; previously this raised :exc:`TypeError`." msgstr "" -#: ../../whatsnew/3.14.rst:2012 +#: ../../whatsnew/3.14.rst:2026 msgid "" "The :attr:`!__args__` attribute of :class:`typing.Union` objects is no " "longer writable." msgstr "" -#: ../../whatsnew/3.14.rst:2015 +#: ../../whatsnew/3.14.rst:2029 msgid "" "It is no longer possible to set any attributes on :class:`~typing.Union` " "objects. This only ever worked for dunder attributes on previous versions, " "was never documented to work, and was subtly broken in many cases." msgstr "" -#: ../../whatsnew/3.14.rst:2020 +#: ../../whatsnew/3.14.rst:2034 msgid "(Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "(由 Jelle Zijlstra 於 :gh:`105499` 貢獻。)" -#: ../../whatsnew/3.14.rst:2022 +#: ../../whatsnew/3.14.rst:2036 msgid ":class:`~typing.TypeAliasType` now supports star unpacking." msgstr "" -#: ../../whatsnew/3.14.rst:2026 +#: ../../whatsnew/3.14.rst:2040 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.14.rst:2028 +#: ../../whatsnew/3.14.rst:2042 msgid "The Unicode database has been updated to Unicode 16.0.0." msgstr "" -#: ../../whatsnew/3.14.rst:2032 +#: ../../whatsnew/3.14.rst:2046 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.14.rst:2036 +#: ../../whatsnew/3.14.rst:2050 msgid "" ":mod:`unittest` output is now colored by default. This can be controlled by :" "ref:`environment variables `. (Contributed by " "Hugo van Kemenade in :gh:`127221`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2041 +#: ../../whatsnew/3.14.rst:2055 msgid "" "unittest discovery supports :term:`namespace package` as start directory " "again. It was removed in Python 3.11. (Contributed by Jacob Walls in :gh:" "`80958`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2045 +#: ../../whatsnew/3.14.rst:2059 msgid "" "A number of new methods were added in the :class:`~unittest.TestCase` class " "that provide more specialized tests." msgstr "" -#: ../../whatsnew/3.14.rst:2048 +#: ../../whatsnew/3.14.rst:2062 msgid "" ":meth:`~unittest.TestCase.assertHasAttr` and :meth:`~unittest.TestCase." "assertNotHasAttr` check whether the object has a particular attribute." msgstr "" -#: ../../whatsnew/3.14.rst:2051 +#: ../../whatsnew/3.14.rst:2065 msgid "" ":meth:`~unittest.TestCase.assertIsSubclass` and :meth:`~unittest.TestCase." "assertNotIsSubclass` check whether the object is a subclass of a particular " "class, or of one of a tuple of classes." msgstr "" -#: ../../whatsnew/3.14.rst:2054 +#: ../../whatsnew/3.14.rst:2068 msgid "" ":meth:`~unittest.TestCase.assertStartsWith`, :meth:`~unittest.TestCase." "assertNotStartsWith`, :meth:`~unittest.TestCase.assertEndsWith` and :meth:" @@ -3186,129 +3207,129 @@ msgid "" "string starts or ends with particular strings." msgstr "" -#: ../../whatsnew/3.14.rst:2060 +#: ../../whatsnew/3.14.rst:2074 msgid "(Contributed by Serhiy Storchaka in :gh:`71339`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`71339` 貢獻。)" -#: ../../whatsnew/3.14.rst:2064 ../../whatsnew/3.14.rst:2556 +#: ../../whatsnew/3.14.rst:2078 ../../whatsnew/3.14.rst:2581 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.14.rst:2066 +#: ../../whatsnew/3.14.rst:2080 msgid "" "Upgrade HTTP digest authentication algorithm for :mod:`urllib.request` by " "supporting SHA-256 digest authentication as specified in :rfc:`7616`. " "(Contributed by Calvin Bui in :gh:`128193`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2070 +#: ../../whatsnew/3.14.rst:2084 msgid "" "Improve ergonomics and standards compliance when parsing and emitting ``file:" "`` URLs." msgstr "" -#: ../../whatsnew/3.14.rst:2073 +#: ../../whatsnew/3.14.rst:2087 msgid "In :func:`~urllib.request.url2pathname`:" msgstr "" -#: ../../whatsnew/3.14.rst:2075 +#: ../../whatsnew/3.14.rst:2089 msgid "" "Accept a complete URL when the new *require_scheme* argument is set to true." msgstr "" -#: ../../whatsnew/3.14.rst:2077 +#: ../../whatsnew/3.14.rst:2091 msgid "Discard URL authority if it matches the local hostname." msgstr "" -#: ../../whatsnew/3.14.rst:2078 +#: ../../whatsnew/3.14.rst:2092 msgid "" "Discard URL authority if it resolves to a local IP address when the new " "*resolve_host* argument is set to true." msgstr "" -#: ../../whatsnew/3.14.rst:2080 +#: ../../whatsnew/3.14.rst:2094 msgid "Discard URL query and fragment components." msgstr "" -#: ../../whatsnew/3.14.rst:2081 +#: ../../whatsnew/3.14.rst:2095 msgid "" "Raise :exc:`~urllib.error.URLError` if a URL authority isn't local, except " "on Windows where we return a UNC path as before." msgstr "" -#: ../../whatsnew/3.14.rst:2084 +#: ../../whatsnew/3.14.rst:2098 msgid "In :func:`~urllib.request.pathname2url`:" msgstr "" -#: ../../whatsnew/3.14.rst:2086 +#: ../../whatsnew/3.14.rst:2100 msgid "" "Return a complete URL when the new *add_scheme* argument is set to true." msgstr "" -#: ../../whatsnew/3.14.rst:2087 +#: ../../whatsnew/3.14.rst:2101 msgid "" "Include an empty URL authority when a path begins with a slash. For example, " "the path ``/etc/hosts`` is converted to the URL ``///etc/hosts``." msgstr "" -#: ../../whatsnew/3.14.rst:2090 +#: ../../whatsnew/3.14.rst:2104 msgid "" "On Windows, drive letters are no longer converted to uppercase, and ``:`` " "characters not following a drive letter no longer cause an :exc:`OSError` " "exception to be raised." msgstr "" -#: ../../whatsnew/3.14.rst:2094 +#: ../../whatsnew/3.14.rst:2108 msgid "(Contributed by Barney Gale in :gh:`125866`.)" msgstr "(由 Barney Gale 於 :gh:`125866` 貢獻。)" -#: ../../whatsnew/3.14.rst:2098 ../../whatsnew/3.14.rst:2278 +#: ../../whatsnew/3.14.rst:2112 ../../whatsnew/3.14.rst:2303 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.14.rst:2100 +#: ../../whatsnew/3.14.rst:2114 msgid "" "Add support for UUID versions 6, 7, and 8 via :func:`~uuid.uuid6`, :func:" "`~uuid.uuid7`, and :func:`~uuid.uuid8` respectively, as specified in :rfc:" "`9562`. (Contributed by Bénédikt Tran in :gh:`89083`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2105 +#: ../../whatsnew/3.14.rst:2119 msgid "" ":const:`~uuid.NIL` and :const:`~uuid.MAX` are now available to represent the " "Nil and Max UUID formats as defined by :rfc:`9562`. (Contributed by Nick " "Pope in :gh:`128427`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2109 +#: ../../whatsnew/3.14.rst:2123 msgid "" "Allow generating multiple UUIDs simultaneously on the command-line via :" "option:`python -m uuid --count `. (Contributed by Simon Legner " "in :gh:`131236`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2115 +#: ../../whatsnew/3.14.rst:2129 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.14.rst:2117 +#: ../../whatsnew/3.14.rst:2131 msgid "" "Names in the :envvar:`BROWSER` environment variable can now refer to already " "registered browsers for the :mod:`webbrowser` module, instead of always " "generating a new browser command." msgstr "" -#: ../../whatsnew/3.14.rst:2121 +#: ../../whatsnew/3.14.rst:2135 msgid "" "This makes it possible to set :envvar:`BROWSER` to the value of one of the " "supported browsers on macOS." msgstr "" -#: ../../whatsnew/3.14.rst:2126 +#: ../../whatsnew/3.14.rst:2140 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.14.rst:2128 +#: ../../whatsnew/3.14.rst:2142 msgid "" "Added :meth:`ZipInfo._for_archive `, a method " "to resolve suitable defaults for a :class:`~zipfile.ZipInfo` object as used " @@ -3316,18 +3337,18 @@ msgid "" "Bénédikt Tran in :gh:`123424`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2133 +#: ../../whatsnew/3.14.rst:2147 msgid "" ":meth:`.ZipFile.writestr` now respects the :envvar:`SOURCE_DATE_EPOCH` " "environment variable in order to better support reproducible builds. " "(Contributed by Jiahao Li in :gh:`91279`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2142 +#: ../../whatsnew/3.14.rst:2156 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.14.rst:2144 +#: ../../whatsnew/3.14.rst:2158 msgid "" "The import time for several standard library modules has been improved, " "including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :" @@ -3338,13 +3359,13 @@ msgid "" "`zipfile`." msgstr "" -#: ../../whatsnew/3.14.rst:2151 +#: ../../whatsnew/3.14.rst:2165 msgid "" "(Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz, " "Hugo van Kemenade, Jelle Zijlstra, and others in :gh:`118761`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2154 +#: ../../whatsnew/3.14.rst:2168 msgid "" "The interpreter now avoids some reference count modifications internally " "when it's safe to do so. This can lead to different values being returned " @@ -3352,7 +3373,7 @@ msgid "" "versions of Python. See :ref:`below ` for details." msgstr "" -#: ../../whatsnew/3.14.rst:2164 +#: ../../whatsnew/3.14.rst:2178 msgid "" "Standard benchmark results have improved by 10-20% following the " "implementation of a new per-thread doubly linked list for :class:`native " @@ -3362,7 +3383,7 @@ msgid "" "running in all threads. (Contributed by Kumar Aditya in :gh:`107803`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2173 +#: ../../whatsnew/3.14.rst:2187 msgid "" "The module now has first class support for :term:`free-threading builds " "`. This enables parallel execution of multiple event loops " @@ -3370,52 +3391,61 @@ msgid "" "(Contributed by Kumar Aditya in :gh:`128002`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2181 +#: ../../whatsnew/3.14.rst:2195 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.14.rst:2183 +#: ../../whatsnew/3.14.rst:2197 msgid "" ":func:`~base64.b16decode` is now up to six times faster. (Contributed by " "Bénédikt Tran, Chris Markiewicz, and Adam Turner in :gh:`118761`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2189 +#: ../../whatsnew/3.14.rst:2203 msgid "bdb" msgstr "bdb" -#: ../../whatsnew/3.14.rst:2191 +#: ../../whatsnew/3.14.rst:2205 msgid "" "The basic debugger now has a :mod:`sys.monitoring`-based backend, which can " "be selected via the passing ``'monitoring'`` to the :class:`~bdb.Bdb` " "class's new *backend* parameter. (Contributed by Tian Gao in :gh:`124533`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2200 +#: ../../whatsnew/3.14.rst:2214 msgid "" "The :func:`~difflib.IS_LINE_JUNK` function is now up to twice as fast. " "(Contributed by Adam Turner and Semyon Moroz in :gh:`130167`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2205 +#: ../../whatsnew/3.14.rst:2219 ../../whatsnew/3.14.rst:3490 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.14.rst:2207 +#: ../../whatsnew/3.14.rst:2223 +msgid "" +"Python 3.14.0-3.14.4 shipped with a new incremental garbage collector. " +"However, due to a number of `reports `__ of significant memory pressure in production environments, " +"it has been reverted back to the generational GC from 3.13. This is the GC " +"now used in Python 3.14.5 and later." +msgstr "" + +#: ../../whatsnew/3.14.rst:2232 msgid "" "The new :ref:`incremental garbage collector ` " "means that maximum pause times are reduced by an order of magnitude or more " "for larger heaps." msgstr "" -#: ../../whatsnew/3.14.rst:2211 +#: ../../whatsnew/3.14.rst:2236 msgid "" "Because of this optimization, the meaning of the results of :meth:`~gc." "get_threshold` and :meth:`~gc.set_threshold` have changed, along with :meth:" "`~gc.get_count` and :meth:`~gc.get_stats`." msgstr "" -#: ../../whatsnew/3.14.rst:2215 +#: ../../whatsnew/3.14.rst:2240 msgid "" "For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " "three-item tuple. The first value is the threshold for young collections, as " @@ -3425,11 +3455,11 @@ msgid "" "zero." msgstr "" -#: ../../whatsnew/3.14.rst:2223 +#: ../../whatsnew/3.14.rst:2248 msgid ":meth:`~gc.set_threshold` now ignores any items after the second." msgstr "" -#: ../../whatsnew/3.14.rst:2225 +#: ../../whatsnew/3.14.rst:2250 msgid "" ":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " "format of results. The only difference is that instead of the results " @@ -3437,28 +3467,28 @@ msgid "" "young generation and the aging and collecting spaces of the old generation." msgstr "" -#: ../../whatsnew/3.14.rst:2232 +#: ../../whatsnew/3.14.rst:2257 msgid "" "In summary, code that attempted to manipulate the behavior of the cycle GC " "may not work exactly as intended, but it is very unlikely to be harmful. All " "other code will work just fine." msgstr "" -#: ../../whatsnew/3.14.rst:2242 +#: ../../whatsnew/3.14.rst:2267 msgid "" "Opening and reading files now executes fewer system calls. Reading a small " "operating system cached file in full is up to 15% faster. (Contributed by " "Cody Maloney and Victor Stinner in :gh:`120754` and :gh:`90102`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2251 +#: ../../whatsnew/3.14.rst:2276 msgid "" ":func:`Path.read_bytes ` now uses unbuffered mode " "to open files, which is between 9% and 17% faster to read in full. " "(Contributed by Cody Maloney in :gh:`120754`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2259 +#: ../../whatsnew/3.14.rst:2284 msgid "" ":mod:`pdb` now supports two backends, based on either :func:`sys.settrace` " "or :mod:`sys.monitoring`. Using the :ref:`pdb CLI ` or :func:" @@ -3468,11 +3498,11 @@ msgid "" "Tian Gao in :gh:`124533`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2269 +#: ../../whatsnew/3.14.rst:2294 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.14.rst:2271 +#: ../../whatsnew/3.14.rst:2296 msgid "" "Optimize the :func:`~textwrap.dedent` function, improving performance by an " "average of 2.4x, with larger improvements for bigger inputs, and fix a bug " @@ -3480,24 +3510,24 @@ msgid "" "other than space and tab." msgstr "" -#: ../../whatsnew/3.14.rst:2280 +#: ../../whatsnew/3.14.rst:2305 msgid "" ":func:`~uuid.uuid3` and :func:`~uuid.uuid5` are now both roughly 40% faster " "for 16-byte names and 20% faster for 1024-byte names. Performance for longer " "names remains unchanged. (Contributed by Bénédikt Tran in :gh:`128150`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2285 +#: ../../whatsnew/3.14.rst:2310 msgid "" ":func:`~uuid.uuid4` is now c. 30% faster. (Contributed by Bénédikt Tran in :" "gh:`128150`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2290 +#: ../../whatsnew/3.14.rst:2315 msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.14.rst:2292 +#: ../../whatsnew/3.14.rst:2317 msgid "" "On Windows, `zlib-ng `__ is now used as " "the implementation of the :mod:`zlib` module in the default binaries. There " @@ -3506,29 +3536,29 @@ msgid "" "compression levels." msgstr "" -#: ../../whatsnew/3.14.rst:2299 +#: ../../whatsnew/3.14.rst:2324 msgid "" "It is worth noting that ``zlib.Z_BEST_SPEED`` (``1``) may result in " "significantly less compression than the previous implementation, whilst also " "significantly reducing the time taken to compress." msgstr "" -#: ../../whatsnew/3.14.rst:2303 +#: ../../whatsnew/3.14.rst:2328 msgid "(Contributed by Steve Dower in :gh:`91349`.)" msgstr "(由 Steve Dower 於 :gh:`91349` 貢獻。)" -#: ../../whatsnew/3.14.rst:2307 +#: ../../whatsnew/3.14.rst:2332 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.14.rst:2312 +#: ../../whatsnew/3.14.rst:2337 msgid "" "Remove the *type*, *choices*, and *metavar* parameters of :class:`!" "BooleanOptionalAction`. These have been deprecated since Python 3.12. " "(Contributed by Nikita Sobolev in :gh:`118805`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2317 +#: ../../whatsnew/3.14.rst:2342 msgid "" "Calling :meth:`~argparse.ArgumentParser.add_argument_group` on an argument " "group now raises a :exc:`ValueError`. Similarly, :meth:`~argparse." @@ -3540,34 +3570,34 @@ msgid "" "Savannah Ostrowski in :gh:`127186`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2331 +#: ../../whatsnew/3.14.rst:2356 msgid "" "Remove the following classes, which have been deprecated aliases of :class:" "`~ast.Constant` since Python 3.8 and have emitted deprecation warnings since " "Python 3.12:" msgstr "" -#: ../../whatsnew/3.14.rst:2335 +#: ../../whatsnew/3.14.rst:2360 msgid ":class:`!Bytes`" msgstr ":class:`!Bytes`" -#: ../../whatsnew/3.14.rst:2336 +#: ../../whatsnew/3.14.rst:2361 msgid ":class:`!Ellipsis`" msgstr ":class:`!Ellipsis`" -#: ../../whatsnew/3.14.rst:2337 +#: ../../whatsnew/3.14.rst:2362 msgid ":class:`!NameConstant`" msgstr ":class:`!NameConstant`" -#: ../../whatsnew/3.14.rst:2338 +#: ../../whatsnew/3.14.rst:2363 msgid ":class:`!Num`" msgstr ":class:`!Num`" -#: ../../whatsnew/3.14.rst:2339 +#: ../../whatsnew/3.14.rst:2364 msgid ":class:`!Str`" msgstr ":class:`!Str`" -#: ../../whatsnew/3.14.rst:2341 +#: ../../whatsnew/3.14.rst:2366 msgid "" "As a consequence of these removals, user-defined ``visit_Num``, " "``visit_Str``, ``visit_Bytes``, ``visit_NameConstant`` and " @@ -3576,92 +3606,92 @@ msgid "" "an AST. Define a ``visit_Constant`` method instead." msgstr "" -#: ../../whatsnew/3.14.rst:2347 +#: ../../whatsnew/3.14.rst:2372 msgid "(Contributed by Alex Waygood in :gh:`119562`.)" msgstr "(由 Alex Waygood 於 :gh:`119562` 貢獻。)" -#: ../../whatsnew/3.14.rst:2349 +#: ../../whatsnew/3.14.rst:2374 msgid "" "Remove the following deprecated properties on :class:`ast.Constant`, which " "were present for compatibility with the now-removed AST classes:" msgstr "" -#: ../../whatsnew/3.14.rst:2352 +#: ../../whatsnew/3.14.rst:2377 msgid ":attr:`!Constant.n`" msgstr ":attr:`!Constant.n`" -#: ../../whatsnew/3.14.rst:2353 +#: ../../whatsnew/3.14.rst:2378 msgid ":attr:`!Constant.s`" msgstr ":attr:`!Constant.s`" -#: ../../whatsnew/3.14.rst:2355 +#: ../../whatsnew/3.14.rst:2380 msgid "" "Use :attr:`!Constant.value` instead. (Contributed by Alex Waygood in :gh:" "`119562`.)" msgstr "" "改用 :attr:`!Constant.value`。(由 Alex Waygood 於 :gh:`119562` 貢獻。)" -#: ../../whatsnew/3.14.rst:2362 +#: ../../whatsnew/3.14.rst:2387 msgid "" "Remove the following classes, methods, and functions, which have been " "deprecated since Python 3.12:" msgstr "" -#: ../../whatsnew/3.14.rst:2365 +#: ../../whatsnew/3.14.rst:2390 msgid ":class:`!AbstractChildWatcher`" msgstr ":class:`!AbstractChildWatcher`" -#: ../../whatsnew/3.14.rst:2366 +#: ../../whatsnew/3.14.rst:2391 msgid ":class:`!FastChildWatcher`" msgstr ":class:`!FastChildWatcher`" -#: ../../whatsnew/3.14.rst:2367 +#: ../../whatsnew/3.14.rst:2392 msgid ":class:`!MultiLoopChildWatcher`" msgstr ":class:`!MultiLoopChildWatcher`" -#: ../../whatsnew/3.14.rst:2368 +#: ../../whatsnew/3.14.rst:2393 msgid ":class:`!PidfdChildWatcher`" msgstr ":class:`!PidfdChildWatcher`" -#: ../../whatsnew/3.14.rst:2369 +#: ../../whatsnew/3.14.rst:2394 msgid ":class:`!SafeChildWatcher`" msgstr ":class:`!SafeChildWatcher`" -#: ../../whatsnew/3.14.rst:2370 +#: ../../whatsnew/3.14.rst:2395 msgid ":class:`!ThreadedChildWatcher`" msgstr ":class:`!ThreadedChildWatcher`" -#: ../../whatsnew/3.14.rst:2371 +#: ../../whatsnew/3.14.rst:2396 msgid ":meth:`!AbstractEventLoopPolicy.get_child_watcher`" msgstr ":meth:`!AbstractEventLoopPolicy.get_child_watcher`" -#: ../../whatsnew/3.14.rst:2372 +#: ../../whatsnew/3.14.rst:2397 msgid ":meth:`!AbstractEventLoopPolicy.set_child_watcher`" msgstr ":meth:`!AbstractEventLoopPolicy.set_child_watcher`" -#: ../../whatsnew/3.14.rst:2373 +#: ../../whatsnew/3.14.rst:2398 msgid ":func:`!get_child_watcher`" msgstr ":func:`!get_child_watcher`" -#: ../../whatsnew/3.14.rst:2374 +#: ../../whatsnew/3.14.rst:2399 msgid ":func:`!set_child_watcher`" msgstr ":func:`!set_child_watcher`" -#: ../../whatsnew/3.14.rst:2376 +#: ../../whatsnew/3.14.rst:2401 msgid "(Contributed by Kumar Aditya in :gh:`120804`.)" msgstr "(由 Kumar Aditya 於 :gh:`120804` 貢獻。)" -#: ../../whatsnew/3.14.rst:2378 +#: ../../whatsnew/3.14.rst:2403 msgid "" ":func:`asyncio.get_event_loop` now raises a :exc:`RuntimeError` if there is " "no current event loop, and no longer implicitly creates an event loop." msgstr "" -#: ../../whatsnew/3.14.rst:2382 +#: ../../whatsnew/3.14.rst:2407 msgid "(Contributed by Kumar Aditya in :gh:`126353`.)" msgstr "(由 Kumar Aditya 於 :gh:`126353` 貢獻。)" -#: ../../whatsnew/3.14.rst:2387 +#: ../../whatsnew/3.14.rst:2412 msgid "" "There's a few patterns that use :func:`asyncio.get_event_loop`, most of them " "can be replaced with :func:`asyncio.run`." @@ -3669,16 +3699,16 @@ msgstr "" "有一些使用 :func:`asyncio.get_event_loop` 的模式,其中大多數可以用 :func:" "`asyncio.run` 取代。" -#: ../../whatsnew/3.14.rst:2390 +#: ../../whatsnew/3.14.rst:2415 msgid "If you're running an async function, simply use :func:`asyncio.run`." msgstr "如果你正在運行非同步函式,只需使用 :func:`asyncio.run`。" -#: ../../whatsnew/3.14.rst:2392 ../../whatsnew/3.14.rst:2419 -#: ../../whatsnew/3.14.rst:2447 +#: ../../whatsnew/3.14.rst:2417 ../../whatsnew/3.14.rst:2444 +#: ../../whatsnew/3.14.rst:2472 msgid "Before:" msgstr "之前是:" -#: ../../whatsnew/3.14.rst:2394 +#: ../../whatsnew/3.14.rst:2419 msgid "" "async def main():\n" " ...\n" @@ -3700,12 +3730,12 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../whatsnew/3.14.rst:2406 ../../whatsnew/3.14.rst:2432 -#: ../../whatsnew/3.14.rst:2463 +#: ../../whatsnew/3.14.rst:2431 ../../whatsnew/3.14.rst:2457 +#: ../../whatsnew/3.14.rst:2488 msgid "After:" msgstr "之後是:" -#: ../../whatsnew/3.14.rst:2408 +#: ../../whatsnew/3.14.rst:2433 msgid "" "async def main():\n" " ...\n" @@ -3717,7 +3747,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../whatsnew/3.14.rst:2415 +#: ../../whatsnew/3.14.rst:2440 msgid "" "If you need to start something, for example, a server listening on a socket " "and then run forever, use :func:`asyncio.run` and an :class:`asyncio.Event`." @@ -3725,7 +3755,7 @@ msgstr "" "如果你需要啟動某些東西然後永遠運行,像是監聽 socket 的伺服器,請使用 :func:" "`asyncio.run` 和 :class:`asyncio.Event`。" -#: ../../whatsnew/3.14.rst:2421 +#: ../../whatsnew/3.14.rst:2446 msgid "" "def start_server(loop): ...\n" "\n" @@ -3745,7 +3775,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../whatsnew/3.14.rst:2434 +#: ../../whatsnew/3.14.rst:2459 msgid "" "def start_server(loop): ...\n" "\n" @@ -3763,7 +3793,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../whatsnew/3.14.rst:2444 +#: ../../whatsnew/3.14.rst:2469 msgid "" "If you need to run something in an event loop, then run some blocking code " "around it, use :class:`asyncio.Runner`." @@ -3771,7 +3801,7 @@ msgstr "" "如果你需要在事件迴圈中運行某些東西,然後在其周圍運行一些阻塞程式碼,請使用 :" "class:`asyncio.Runner`。" -#: ../../whatsnew/3.14.rst:2449 +#: ../../whatsnew/3.14.rst:2474 msgid "" "async def operation_one(): ...\n" "def blocking_code(): ...\n" @@ -3797,7 +3827,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../whatsnew/3.14.rst:2465 +#: ../../whatsnew/3.14.rst:2490 msgid "" "async def operation_one(): ...\n" "def blocking_code(): ...\n" @@ -3817,26 +3847,26 @@ msgstr "" " blocking_code()\n" " runner.run(operation_two())" -#: ../../whatsnew/3.14.rst:2478 +#: ../../whatsnew/3.14.rst:2503 msgid "email" msgstr "email" -#: ../../whatsnew/3.14.rst:2480 +#: ../../whatsnew/3.14.rst:2505 msgid "" "Remove :func:`email.utils.localtime`'s *isdst* parameter, which was " "deprecated in and has been ignored since Python 3.12. (Contributed by Hugo " "van Kemenade in :gh:`118798`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2486 +#: ../../whatsnew/3.14.rst:2511 msgid "importlib.abc" msgstr "importlib.abc" -#: ../../whatsnew/3.14.rst:2488 +#: ../../whatsnew/3.14.rst:2513 msgid "Remove deprecated :mod:`importlib.abc` classes:" msgstr "移除已棄用的 :mod:`importlib.abc` 類別:" -#: ../../whatsnew/3.14.rst:2490 +#: ../../whatsnew/3.14.rst:2515 msgid "" ":class:`!ResourceReader` (use :class:`~importlib.resources.abc." "TraversableResources`)" @@ -3844,14 +3874,14 @@ msgstr "" ":class:`!ResourceReader`\\ (請改用 :class:`~importlib.resources.abc." "TraversableResources`)" -#: ../../whatsnew/3.14.rst:2492 +#: ../../whatsnew/3.14.rst:2517 msgid "" ":class:`!Traversable` (use :class:`~importlib.resources.abc.Traversable`)" msgstr "" ":class:`!Traversable`\\ (請改用 :class:`~importlib.resources.abc." "Traversable`)" -#: ../../whatsnew/3.14.rst:2494 +#: ../../whatsnew/3.14.rst:2519 msgid "" ":class:`!TraversableResources` (use :class:`~importlib.resources.abc." "TraversableResources`)" @@ -3859,29 +3889,29 @@ msgstr "" ":class:`!TraversableResources`\\ (請改用 :class:`~importlib.resources.abc." "TraversableResources`)" -#: ../../whatsnew/3.14.rst:2497 +#: ../../whatsnew/3.14.rst:2522 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.14.rst:2501 +#: ../../whatsnew/3.14.rst:2526 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.14.rst:2503 +#: ../../whatsnew/3.14.rst:2528 msgid "" "Remove support for copy, deepcopy, and pickle operations from :mod:" "`itertools` iterators. These have emitted a :exc:`DeprecationWarning` since " "Python 3.12. (Contributed by Raymond Hettinger in :gh:`101588`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2512 +#: ../../whatsnew/3.14.rst:2537 msgid "" "Remove support for passing additional keyword arguments to :class:`~pathlib." "Path`. In previous versions, any such arguments are ignored. (Contributed by " "Barney Gale in :gh:`74033`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2517 +#: ../../whatsnew/3.14.rst:2542 msgid "" "Remove support for passing additional positional arguments to :meth:`." "PurePath.relative_to` and :meth:`~pathlib.PurePath.is_relative_to`. In " @@ -3889,33 +3919,33 @@ msgid "" "by Barney Gale in :gh:`78707`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2524 +#: ../../whatsnew/3.14.rst:2549 msgid "pkgutil" msgstr "pkgutil" -#: ../../whatsnew/3.14.rst:2526 +#: ../../whatsnew/3.14.rst:2551 msgid "" "Remove the :func:`!get_loader` and :func:`!find_loader` functions, which " "have been deprecated since Python 3.12. (Contributed by Bénédikt Tran in :gh:" "`97850`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2532 +#: ../../whatsnew/3.14.rst:2557 msgid "pty" msgstr "pty" -#: ../../whatsnew/3.14.rst:2534 +#: ../../whatsnew/3.14.rst:2559 msgid "" "Remove the :func:`!master_open` and :func:`!slave_open` functions, which " "have been deprecated since Python 3.12. Use :func:`pty.openpty` instead. " "(Contributed by Nikita Sobolev in :gh:`118824`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2541 +#: ../../whatsnew/3.14.rst:2566 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.14.rst:2543 +#: ../../whatsnew/3.14.rst:2568 msgid "" "Remove :data:`!version` and :data:`!version_info` from the :mod:`sqlite3` " "module; use :data:`~sqlite3.sqlite_version` and :data:`~sqlite3." @@ -3923,27 +3953,27 @@ msgid "" "library. (Contributed by Hugo van Kemenade in :gh:`118924`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2549 +#: ../../whatsnew/3.14.rst:2574 msgid "" "Using a sequence of parameters with named placeholders now raises a :exc:" "`~sqlite3.ProgrammingError`, having been deprecated since Python 3.12. " "(Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2558 +#: ../../whatsnew/3.14.rst:2583 msgid "" "Remove the :class:`!Quoter` class from :mod:`urllib.parse`, which has been " "deprecated since Python 3.11. (Contributed by Nikita Sobolev in :gh:" "`118827`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2562 +#: ../../whatsnew/3.14.rst:2587 msgid "" "Remove the :class:`!URLopener` and :class:`!FancyURLopener` classes from :" "mod:`urllib.request`, which have been deprecated since Python 3.3." msgstr "" -#: ../../whatsnew/3.14.rst:2566 +#: ../../whatsnew/3.14.rst:2591 msgid "" "``myopener.open()`` can be replaced with :func:`~urllib.request.urlopen`. " "``myopener.retrieve()`` can be replaced with :func:`~urllib.request." @@ -3952,15 +3982,15 @@ msgid "" "(Contributed by Barney Gale in :gh:`84850`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2575 +#: ../../whatsnew/3.14.rst:2600 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.14.rst:2578 +#: ../../whatsnew/3.14.rst:2603 msgid "New deprecations" msgstr "" -#: ../../whatsnew/3.14.rst:2580 +#: ../../whatsnew/3.14.rst:2605 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; complex numbers should only be " @@ -3971,12 +4001,12 @@ msgstr "" "用;複數應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢" "獻。)" -#: ../../whatsnew/3.14.rst:2585 +#: ../../whatsnew/3.14.rst:2610 #: ../../deprecations/pending-removal-in-future.rst:7 msgid ":mod:`argparse`:" msgstr ":mod:`argparse`:" -#: ../../whatsnew/3.14.rst:2587 +#: ../../whatsnew/3.14.rst:2612 msgid "" "Passing the undocumented keyword argument *prefix_chars* to the :meth:" "`~argparse.ArgumentParser.add_argument_group` method is now deprecated. " @@ -3986,19 +4016,19 @@ msgstr "" "ArgumentParser.add_argument_group` 的做法現在已被棄用。(由 Savannah " "Ostrowski 於 :gh:`125563` 貢獻。)" -#: ../../whatsnew/3.14.rst:2591 +#: ../../whatsnew/3.14.rst:2616 msgid "" "Deprecated the :class:`argparse.FileType` type converter. Anything relating " "to resource management should be handled downstream, after the arguments " "have been parsed. (Contributed by Serhiy Storchaka in :gh:`58032`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2596 +#: ../../whatsnew/3.14.rst:2621 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.14.rst:2598 +#: ../../whatsnew/3.14.rst:2623 msgid "" "The :func:`!asyncio.iscoroutinefunction` is now deprecated and will be " "removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. " @@ -4008,7 +4038,7 @@ msgstr "" "用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" "gh:`122875` 貢獻。)" -#: ../../whatsnew/3.14.rst:2603 +#: ../../whatsnew/3.14.rst:2628 msgid "" "The :mod:`asyncio` policy system is deprecated and will be removed in Python " "3.16. In particular, the following classes and functions are deprecated:" @@ -4016,37 +4046,37 @@ msgstr "" ":mod:`asyncio` 策略系統已被棄用並將在 Python 3.16 中移除。特別是以下類別和函" "式已被棄用:" -#: ../../whatsnew/3.14.rst:2607 +#: ../../whatsnew/3.14.rst:2632 #: ../../deprecations/pending-removal-in-3.16.rst:29 msgid ":class:`asyncio.AbstractEventLoopPolicy`" msgstr ":class:`asyncio.AbstractEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2608 +#: ../../whatsnew/3.14.rst:2633 #: ../../deprecations/pending-removal-in-3.16.rst:30 msgid ":class:`asyncio.DefaultEventLoopPolicy`" msgstr ":class:`asyncio.DefaultEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2609 +#: ../../whatsnew/3.14.rst:2634 #: ../../deprecations/pending-removal-in-3.16.rst:31 msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" msgstr ":class:`asyncio.WindowsSelectorEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2610 +#: ../../whatsnew/3.14.rst:2635 #: ../../deprecations/pending-removal-in-3.16.rst:32 msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" msgstr ":class:`asyncio.WindowsProactorEventLoopPolicy`" -#: ../../whatsnew/3.14.rst:2611 +#: ../../whatsnew/3.14.rst:2636 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":func:`asyncio.get_event_loop_policy`" msgstr ":func:`asyncio.get_event_loop_policy`" -#: ../../whatsnew/3.14.rst:2612 +#: ../../whatsnew/3.14.rst:2637 #: ../../deprecations/pending-removal-in-3.16.rst:34 msgid ":func:`asyncio.set_event_loop_policy`" msgstr ":func:`asyncio.set_event_loop_policy`" -#: ../../whatsnew/3.14.rst:2614 +#: ../../whatsnew/3.14.rst:2639 msgid "" "Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with the " "*loop_factory* argument to use the desired event loop implementation." @@ -4054,11 +4084,11 @@ msgstr "" "使用者應該使用 :func:`asyncio.run` 或 :class:`asyncio.Runner` 搭配 " "*loop_factory* 引數來使用所需的事件迴圈實作。" -#: ../../whatsnew/3.14.rst:2617 +#: ../../whatsnew/3.14.rst:2642 msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows:" msgstr "例如在 Windows 上使用 :class:`asyncio.SelectorEventLoop`:" -#: ../../whatsnew/3.14.rst:2619 +#: ../../whatsnew/3.14.rst:2644 #: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" "import asyncio\n" @@ -4075,12 +4105,12 @@ msgstr "" "\n" "asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" -#: ../../whatsnew/3.14.rst:2628 +#: ../../whatsnew/3.14.rst:2653 #: ../../deprecations/pending-removal-in-3.16.rst:48 msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" msgstr "(由 Kumar Aditya 於 :gh:`127949` 貢獻。)" -#: ../../whatsnew/3.14.rst:2630 +#: ../../whatsnew/3.14.rst:2655 msgid "" ":mod:`codecs`: The :func:`codecs.open` function is now deprecated, and will " "be removed in a future version of Python. Use :func:`open` instead. " @@ -4089,13 +4119,13 @@ msgstr "" ":mod:`codecs`: :func:`codecs.open` 函式已被棄用,並將在未來的 Python 版本中移" "除。請改用 :func:`open`。(由 Inada Naoki 於 :gh:`133036` 貢獻。)" -#: ../../whatsnew/3.14.rst:2636 +#: ../../whatsnew/3.14.rst:2661 #: ../../deprecations/pending-removal-in-3.15.rst:16 #: ../../deprecations/pending-removal-in-3.19.rst:4 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.14.rst:2638 +#: ../../whatsnew/3.14.rst:2663 msgid "" "On non-Windows platforms, setting :attr:`.Structure._pack_` to use a MSVC-" "compatible default memory layout is now deprecated in favor of setting :attr:" @@ -4103,7 +4133,7 @@ msgid "" "(Contributed by Petr Viktorin in :gh:`131747`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2643 +#: ../../whatsnew/3.14.rst:2668 msgid "" "Calling :func:`ctypes.POINTER` on a string is now deprecated. Use :ref:" "`incomplete types ` for self-referential " @@ -4112,7 +4142,7 @@ msgid "" "by Sergey Myrianov in :gh:`100926`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2650 +#: ../../whatsnew/3.14.rst:2675 msgid "" ":mod:`functools`: Calling the Python implementation of :func:`functools." "reduce` with *function* or *sequence* as keyword arguments is now " @@ -4123,7 +4153,7 @@ msgstr "" "`functools.reduce` 的 Python 實作已被棄用;這些參數將在 Python 3.16 中變為僅" "限位置引數。(由 Kirill Podoprigora 於 :gh:`121676` 貢獻。)" -#: ../../whatsnew/3.14.rst:2656 +#: ../../whatsnew/3.14.rst:2681 msgid "" ":mod:`logging`: Support for custom logging handlers with the *strm* argument " "is now deprecated and scheduled for removal in Python 3.16. Define handlers " @@ -4134,7 +4164,7 @@ msgstr "" "劃在 Python 3.16 中移除。請改為使用 *stream* 引數來定義處理函式。(由 " "Mariusz Felisiak 於 :gh:`115032` 貢獻。)" -#: ../../whatsnew/3.14.rst:2662 +#: ../../whatsnew/3.14.rst:2687 msgid "" ":mod:`mimetypes`: Valid extensions are either empty or must start with '.' " "for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " @@ -4145,14 +4175,14 @@ msgstr "" "add_type` 以 '.' 開頭。未加點的副檔名已被棄用,並將在 Python 3.16 中引發 :" "exc:`ValueError`。(由 Hugo van Kemenade 於 :gh:`75223` 貢獻。)" -#: ../../whatsnew/3.14.rst:2669 +#: ../../whatsnew/3.14.rst:2694 msgid "" ":mod:`!nturl2path`: This module is now deprecated. Call :func:`urllib." "request.url2pathname` and :func:`~urllib.request.pathname2url` instead. " "(Contributed by Barney Gale in :gh:`125866`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2674 +#: ../../whatsnew/3.14.rst:2699 msgid "" ":mod:`os`: The :func:`os.popen` and :func:`os.spawn* ` functions " "are now :term:`soft deprecated`. They should no longer be used to write new " @@ -4160,14 +4190,14 @@ msgid "" "Victor Stinner in :gh:`120743`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2681 +#: ../../whatsnew/3.14.rst:2706 msgid "" ":mod:`pathlib`: :meth:`!pathlib.PurePath.as_uri` is now deprecated and " "scheduled for removal in Python 3.19. Use :meth:`pathlib.Path.as_uri` " "instead. (Contributed by Barney Gale in :gh:`123599`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2687 +#: ../../whatsnew/3.14.rst:2712 msgid "" ":mod:`pdb`: The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a " "deprecated read-only property, which will be removed in a future version of " @@ -4178,14 +4208,14 @@ msgid "" "(Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2696 +#: ../../whatsnew/3.14.rst:2721 msgid "" ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " "lack of interest, scheduled for removal in Python 3.16. (Contributed by " "Bénédikt Tran in :gh:`119698`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2701 +#: ../../whatsnew/3.14.rst:2726 msgid "" ":mod:`tkinter`: The :class:`!tkinter.Variable` methods :meth:`!" "trace_variable`, :meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now " @@ -4193,7 +4223,7 @@ msgid "" "trace_info` instead. (Contributed by Serhiy Storchaka in :gh:`120220`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2707 +#: ../../whatsnew/3.14.rst:2732 msgid "" ":mod:`urllib.parse`: Accepting objects with false values (like ``0`` and " "``[]``) except empty strings, bytes-like objects and ``None`` in :func:" @@ -5119,18 +5149,18 @@ msgstr "" ":func:`sys._clear_type_cache` 已被棄用:請改用 :func:`sys." "_clear_internal_caches`。" -#: ../../whatsnew/3.14.rst:2729 +#: ../../whatsnew/3.14.rst:2754 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.14.rst:2731 +#: ../../whatsnew/3.14.rst:2756 msgid "" "Replaced the opcode :opcode:`!BINARY_SUBSCR` by the :opcode:`BINARY_OP` " "opcode with the ``NB_SUBSCR`` oparg. (Contributed by Irit Katriel in :gh:" "`100239`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2735 +#: ../../whatsnew/3.14.rst:2760 msgid "" "Add the :opcode:`BUILD_INTERPOLATION` and :opcode:`BUILD_TEMPLATE` opcodes " "to construct new :class:`~string.templatelib.Interpolation` and :class:" @@ -5139,20 +5169,20 @@ msgid "" "Template strings `)." msgstr "" -#: ../../whatsnew/3.14.rst:2741 +#: ../../whatsnew/3.14.rst:2766 msgid "" "Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode. Use :opcode:`BUILD_MAP` " "instead. (Contributed by Mark Shannon in :gh:`122160`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2745 +#: ../../whatsnew/3.14.rst:2770 msgid "" "Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with :opcode:" "`LOAD_COMMON_CONSTANT` and add support for loading :exc:" "`NotImplementedError`." msgstr "" -#: ../../whatsnew/3.14.rst:2749 +#: ../../whatsnew/3.14.rst:2774 msgid "" "Add the :opcode:`LOAD_FAST_BORROW` and :opcode:" "`LOAD_FAST_BORROW_LOAD_FAST_BORROW` opcodes to reduce reference counting " @@ -5161,14 +5191,14 @@ msgid "" "gh:`130704`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2754 +#: ../../whatsnew/3.14.rst:2779 msgid "" "Add the :opcode:`LOAD_SMALL_INT` opcode, which pushes a small integer equal " "to the ``oparg`` to the stack. The :opcode:`!RETURN_CONST` opcode is removed " "as it is no longer used. (Contributed by Mark Shannon in :gh:`125837`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2759 +#: ../../whatsnew/3.14.rst:2784 msgid "" "Add the new :opcode:`LOAD_SPECIAL` instruction. Generate code for :keyword:" "`with` and :keyword:`async with` statements using the new instruction. " @@ -5176,17 +5206,17 @@ msgid "" "instructions. (Contributed by Mark Shannon in :gh:`120507`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2765 +#: ../../whatsnew/3.14.rst:2790 msgid "" "Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators. " "(Contributed by Mark Shannon in :gh:`132554`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2770 +#: ../../whatsnew/3.14.rst:2795 msgid "Pseudo-instructions" msgstr "" -#: ../../whatsnew/3.14.rst:2772 +#: ../../whatsnew/3.14.rst:2797 msgid "" "Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction to support " "partially executed module-level annotations with :ref:`deferred evaluation " @@ -5194,14 +5224,14 @@ msgid "" "Zijlstra in :gh:`130907`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2777 +#: ../../whatsnew/3.14.rst:2802 msgid "" "Add the :opcode:`!BINARY_OP_EXTEND` pseudo instruction, which executes a " "pair of functions (guard and specialization functions) accessed from the " "inline cache. (Contributed by Irit Katriel in :gh:`100239`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2782 +#: ../../whatsnew/3.14.rst:2807 msgid "" "Add three specializations for :opcode:`CALL_KW`; :opcode:`!CALL_KW_PY` for " "calls to Python functions, :opcode:`!CALL_KW_BOUND_METHOD` for calls to " @@ -5209,7 +5239,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`118093`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2788 +#: ../../whatsnew/3.14.rst:2813 msgid "" "Add the :opcode:`JUMP_IF_TRUE` and :opcode:`JUMP_IF_FALSE` pseudo " "instructions, conditional jumps which do not impact the stack. Replaced by " @@ -5217,55 +5247,55 @@ msgid "" "(Contributed by Irit Katriel in :gh:`124285`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2793 +#: ../../whatsnew/3.14.rst:2818 msgid "" "Add the :opcode:`!LOAD_CONST_MORTAL` pseudo instruction. (Contributed by " "Mark Shannon in :gh:`128685`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2796 +#: ../../whatsnew/3.14.rst:2821 msgid "" "Add the :opcode:`LOAD_CONST_IMMORTAL` pseudo instruction, which does the " "same as :opcode:`!LOAD_CONST`, but is more efficient for immortal objects. " "(Contributed by Mark Shannon in :gh:`125837`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2801 +#: ../../whatsnew/3.14.rst:2826 msgid "" "Add the :opcode:`NOT_TAKEN` pseudo instruction, used by :mod:`sys." "monitoring` to record branch events (such as :monitoring-event:" "`BRANCH_LEFT`). (Contributed by Mark Shannon in :gh:`122548`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2807 +#: ../../whatsnew/3.14.rst:2832 msgid "C API changes" msgstr "C API 變更" -#: ../../whatsnew/3.14.rst:2812 +#: ../../whatsnew/3.14.rst:2837 msgid "Python configuration C API" msgstr "Python 配置 C API" -#: ../../whatsnew/3.14.rst:2814 +#: ../../whatsnew/3.14.rst:2839 msgid "" "Add a :ref:`PyInitConfig C API ` to configure the Python " "initialization without relying on C structures and the ability to make ABI-" "compatible changes in the future." msgstr "" -#: ../../whatsnew/3.14.rst:2818 +#: ../../whatsnew/3.14.rst:2843 msgid "" "Complete the :pep:`587` :ref:`PyConfig C API ` by adding :c:" "func:`PyInitConfig_AddModule` which can be used to add a built-in extension " "module; a feature previously referred to as the \"inittab\"." msgstr "" -#: ../../whatsnew/3.14.rst:2822 +#: ../../whatsnew/3.14.rst:2847 msgid "" "Add :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions to get and " "set the current runtime configuration." msgstr "" -#: ../../whatsnew/3.14.rst:2825 +#: ../../whatsnew/3.14.rst:2850 msgid "" ":pep:`587` 'Python Initialization Configuration' unified all the ways to " "configure Python's initialization. This PEP also unifies the configuration " @@ -5274,7 +5304,7 @@ msgid "" "two 'Python' and 'Isolated' choices (PEP 587), to further simplify the API." msgstr "" -#: ../../whatsnew/3.14.rst:2832 +#: ../../whatsnew/3.14.rst:2857 msgid "" "The lower level PEP 587 PyConfig API remains available for use cases with an " "intentionally higher level of coupling to CPython implementation details " @@ -5282,20 +5312,20 @@ msgid "" "configuration mechanisms)." msgstr "" -#: ../../whatsnew/3.14.rst:2837 ../../whatsnew/3.14.rst:2864 -#: ../../whatsnew/3.14.rst:2884 +#: ../../whatsnew/3.14.rst:2862 ../../whatsnew/3.14.rst:2889 +#: ../../whatsnew/3.14.rst:2909 msgid "(Contributed by Victor Stinner in :gh:`107954`.)" msgstr "(由 Victor Stinner 於 :gh:`107954` 貢獻。)" -#: ../../whatsnew/3.14.rst:2839 +#: ../../whatsnew/3.14.rst:2864 msgid ":pep:`741` and :pep:`587`" msgstr ":pep:`741` 和 :pep:`587`" -#: ../../whatsnew/3.14.rst:2843 +#: ../../whatsnew/3.14.rst:2868 msgid "New features in the C API" msgstr "C API 中的新功能" -#: ../../whatsnew/3.14.rst:2845 +#: ../../whatsnew/3.14.rst:2870 msgid "" "Add :c:func:`Py_PACK_VERSION` and :c:func:`Py_PACK_FULL_VERSION`, two new " "macros for bit-packing Python version numbers. This is useful for " @@ -5303,14 +5333,14 @@ msgid "" "(Contributed by Petr Viktorin in :gh:`128629`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2851 +#: ../../whatsnew/3.14.rst:2876 msgid "" "Add :c:func:`PyBytes_Join(sep, iterable) ` function, similar " "to ``sep.join(iterable)`` in Python. (Contributed by Victor Stinner in :gh:" "`121645`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2855 +#: ../../whatsnew/3.14.rst:2880 msgid "" "Add functions to manipulate the configuration of the current runtime Python " "interpreter (:ref:`PEP 741: Python configuration C API `):" -#: ../../whatsnew/3.14.rst:2859 +#: ../../whatsnew/3.14.rst:2884 msgid ":c:func:`PyConfig_Get`" msgstr ":c:func:`PyConfig_Get`" -#: ../../whatsnew/3.14.rst:2860 +#: ../../whatsnew/3.14.rst:2885 msgid ":c:func:`PyConfig_GetInt`" msgstr ":c:func:`PyConfig_GetInt`" -#: ../../whatsnew/3.14.rst:2861 +#: ../../whatsnew/3.14.rst:2886 msgid ":c:func:`PyConfig_Set`" msgstr ":c:func:`PyConfig_Set`" -#: ../../whatsnew/3.14.rst:2862 +#: ../../whatsnew/3.14.rst:2887 msgid ":c:func:`PyConfig_Names`" msgstr ":c:func:`PyConfig_Names`" -#: ../../whatsnew/3.14.rst:2866 +#: ../../whatsnew/3.14.rst:2891 msgid "" "Add functions to configure Python initialization (:ref:`PEP 741: Python " "configuration C API `):" @@ -5343,63 +5373,63 @@ msgstr "" "新增用於配置 Python 初始化的函式(:ref:`PEP 741:Python 配置 C API " "`):" -#: ../../whatsnew/3.14.rst:2869 +#: ../../whatsnew/3.14.rst:2894 msgid ":c:func:`Py_InitializeFromInitConfig`" msgstr ":c:func:`Py_InitializeFromInitConfig`" -#: ../../whatsnew/3.14.rst:2870 +#: ../../whatsnew/3.14.rst:2895 msgid ":c:func:`PyInitConfig_AddModule`" msgstr ":c:func:`PyInitConfig_AddModule`" -#: ../../whatsnew/3.14.rst:2871 +#: ../../whatsnew/3.14.rst:2896 msgid ":c:func:`PyInitConfig_Create`" msgstr ":c:func:`PyInitConfig_Create`" -#: ../../whatsnew/3.14.rst:2872 +#: ../../whatsnew/3.14.rst:2897 msgid ":c:func:`PyInitConfig_Free`" msgstr ":c:func:`PyInitConfig_Free`" -#: ../../whatsnew/3.14.rst:2873 +#: ../../whatsnew/3.14.rst:2898 msgid ":c:func:`PyInitConfig_FreeStrList`" msgstr ":c:func:`PyInitConfig_FreeStrList`" -#: ../../whatsnew/3.14.rst:2874 +#: ../../whatsnew/3.14.rst:2899 msgid ":c:func:`PyInitConfig_GetError`" msgstr ":c:func:`PyInitConfig_GetError`" -#: ../../whatsnew/3.14.rst:2875 +#: ../../whatsnew/3.14.rst:2900 msgid ":c:func:`PyInitConfig_GetExitCode`" msgstr ":c:func:`PyInitConfig_GetExitCode`" -#: ../../whatsnew/3.14.rst:2876 +#: ../../whatsnew/3.14.rst:2901 msgid ":c:func:`PyInitConfig_GetInt`" msgstr ":c:func:`PyInitConfig_GetInt`" -#: ../../whatsnew/3.14.rst:2877 +#: ../../whatsnew/3.14.rst:2902 msgid ":c:func:`PyInitConfig_GetStr`" msgstr ":c:func:`PyInitConfig_GetStr`" -#: ../../whatsnew/3.14.rst:2878 +#: ../../whatsnew/3.14.rst:2903 msgid ":c:func:`PyInitConfig_GetStrList`" msgstr ":c:func:`PyInitConfig_GetStrList`" -#: ../../whatsnew/3.14.rst:2879 +#: ../../whatsnew/3.14.rst:2904 msgid ":c:func:`PyInitConfig_HasOption`" msgstr ":c:func:`PyInitConfig_HasOption`" -#: ../../whatsnew/3.14.rst:2880 +#: ../../whatsnew/3.14.rst:2905 msgid ":c:func:`PyInitConfig_SetInt`" msgstr ":c:func:`PyInitConfig_SetInt`" -#: ../../whatsnew/3.14.rst:2881 +#: ../../whatsnew/3.14.rst:2906 msgid ":c:func:`PyInitConfig_SetStr`" msgstr ":c:func:`PyInitConfig_SetStr`" -#: ../../whatsnew/3.14.rst:2882 +#: ../../whatsnew/3.14.rst:2907 msgid ":c:func:`PyInitConfig_SetStrList`" msgstr ":c:func:`PyInitConfig_SetStrList`" -#: ../../whatsnew/3.14.rst:2886 +#: ../../whatsnew/3.14.rst:2911 msgid "" "Add :c:func:`Py_fopen` function to open a file. This works similarly to the " "standard C :c:func:`!fopen` function, instead accepting a Python object for " @@ -5408,13 +5438,13 @@ msgid "" "(Contributed by Victor Stinner in :gh:`127350`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2894 +#: ../../whatsnew/3.14.rst:2919 msgid "" "Add :c:func:`Py_HashBuffer` to compute and return the hash value of a " "buffer. (Contributed by Antoine Pitrou and Victor Stinner in :gh:`122854`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2897 +#: ../../whatsnew/3.14.rst:2922 msgid "" "Add :c:func:`PyImport_ImportModuleAttr` and :c:func:" "`PyImport_ImportModuleAttrString` helper functions to import a module and " @@ -5422,20 +5452,20 @@ msgid "" "`128911`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2902 +#: ../../whatsnew/3.14.rst:2927 msgid "" "Add :c:func:`PyIter_NextItem` to replace :c:func:`PyIter_Next`, which has an " "ambiguous return value. (Contributed by Irit Katriel and Erlend Aasland in :" "gh:`105201`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2906 +#: ../../whatsnew/3.14.rst:2931 msgid "" "Add :c:func:`PyLong_GetSign` function to get the sign of :class:`int` " "objects. (Contributed by Sergey B Kirpichev in :gh:`116560`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2909 +#: ../../whatsnew/3.14.rst:2934 msgid "" "Add :c:func:`PyLong_IsPositive`, :c:func:`PyLong_IsNegative` and :c:func:" "`PyLong_IsZero` for checking if :c:type:`PyLongObject` is positive, " @@ -5443,82 +5473,82 @@ msgid "" "Kirpichev in :gh:`126061`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2914 +#: ../../whatsnew/3.14.rst:2939 msgid "" "Add new functions to convert C ```` numbers to/from Python :class:" "`int` objects:" msgstr "" -#: ../../whatsnew/3.14.rst:2917 +#: ../../whatsnew/3.14.rst:2942 msgid ":c:func:`PyLong_AsInt32`" msgstr ":c:func:`PyLong_AsInt32`" -#: ../../whatsnew/3.14.rst:2918 +#: ../../whatsnew/3.14.rst:2943 msgid ":c:func:`PyLong_AsInt64`" msgstr ":c:func:`PyLong_AsInt64`" -#: ../../whatsnew/3.14.rst:2919 +#: ../../whatsnew/3.14.rst:2944 msgid ":c:func:`PyLong_AsUInt32`" msgstr ":c:func:`PyLong_AsUInt32`" -#: ../../whatsnew/3.14.rst:2920 +#: ../../whatsnew/3.14.rst:2945 msgid ":c:func:`PyLong_AsUInt64`" msgstr ":c:func:`PyLong_AsUInt64`" -#: ../../whatsnew/3.14.rst:2921 +#: ../../whatsnew/3.14.rst:2946 msgid ":c:func:`PyLong_FromInt32`" msgstr ":c:func:`PyLong_FromInt32`" -#: ../../whatsnew/3.14.rst:2922 +#: ../../whatsnew/3.14.rst:2947 msgid ":c:func:`PyLong_FromInt64`" msgstr ":c:func:`PyLong_FromInt64`" -#: ../../whatsnew/3.14.rst:2923 +#: ../../whatsnew/3.14.rst:2948 msgid ":c:func:`PyLong_FromUInt32`" msgstr ":c:func:`PyLong_FromUInt32`" -#: ../../whatsnew/3.14.rst:2924 +#: ../../whatsnew/3.14.rst:2949 msgid ":c:func:`PyLong_FromUInt64`" msgstr ":c:func:`PyLong_FromUInt64`" -#: ../../whatsnew/3.14.rst:2926 +#: ../../whatsnew/3.14.rst:2951 msgid "(Contributed by Victor Stinner in :gh:`120389`.)" msgstr "(由 Victor Stinner 於 :gh:`120389` 貢獻。)" -#: ../../whatsnew/3.14.rst:2928 +#: ../../whatsnew/3.14.rst:2953 msgid "" "Add a new import and export API for Python :class:`int` objects (:pep:`757`):" msgstr "" -#: ../../whatsnew/3.14.rst:2931 +#: ../../whatsnew/3.14.rst:2956 msgid ":c:func:`PyLong_GetNativeLayout`" msgstr ":c:func:`PyLong_GetNativeLayout`" -#: ../../whatsnew/3.14.rst:2932 +#: ../../whatsnew/3.14.rst:2957 msgid ":c:func:`PyLong_Export`" msgstr ":c:func:`PyLong_Export`" -#: ../../whatsnew/3.14.rst:2933 +#: ../../whatsnew/3.14.rst:2958 msgid ":c:func:`PyLong_FreeExport`" msgstr ":c:func:`PyLong_FreeExport`" -#: ../../whatsnew/3.14.rst:2934 +#: ../../whatsnew/3.14.rst:2959 msgid ":c:func:`PyLongWriter_Create`" msgstr ":c:func:`PyLongWriter_Create`" -#: ../../whatsnew/3.14.rst:2935 +#: ../../whatsnew/3.14.rst:2960 msgid ":c:func:`PyLongWriter_Finish`" msgstr ":c:func:`PyLongWriter_Finish`" -#: ../../whatsnew/3.14.rst:2936 +#: ../../whatsnew/3.14.rst:2961 msgid ":c:func:`PyLongWriter_Discard`" msgstr ":c:func:`PyLongWriter_Discard`" -#: ../../whatsnew/3.14.rst:2938 +#: ../../whatsnew/3.14.rst:2963 msgid "(Contributed by Sergey B Kirpichev and Victor Stinner in :gh:`102471`.)" msgstr "(由 Sergey B Kirpichev 和 Victor Stinner 於 :gh:`102471` 貢獻。)" -#: ../../whatsnew/3.14.rst:2940 +#: ../../whatsnew/3.14.rst:2965 msgid "" "Add :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:func:" "`PyMonitoring_FireBranchRightEvent` for generating :monitoring-event:" @@ -5526,13 +5556,13 @@ msgid "" "(Contributed by Mark Shannon in :gh:`122548`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2946 +#: ../../whatsnew/3.14.rst:2971 msgid "" "Add :c:func:`PyType_Freeze` function to make a type immutable. (Contributed " "by Victor Stinner in :gh:`121654`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2949 +#: ../../whatsnew/3.14.rst:2974 msgid "" "Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for " "easier superclass identification, which attempts to resolve the type " @@ -5540,110 +5570,110 @@ msgid "" "in :gh:`124153`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2954 +#: ../../whatsnew/3.14.rst:2979 msgid "" "Add a new :c:func:`PyUnicode_Equal` function to test if two strings are " "equal. The function is also added to the Limited C API. (Contributed by " "Victor Stinner in :gh:`124502`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2959 +#: ../../whatsnew/3.14.rst:2984 msgid "" "Add a new :c:type:`PyUnicodeWriter` API to create a Python :class:`str` " "object, with the following functions:" msgstr "" -#: ../../whatsnew/3.14.rst:2962 +#: ../../whatsnew/3.14.rst:2987 msgid ":c:func:`PyUnicodeWriter_Create`" msgstr ":c:func:`PyUnicodeWriter_Create`" -#: ../../whatsnew/3.14.rst:2963 +#: ../../whatsnew/3.14.rst:2988 msgid ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" msgstr ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" -#: ../../whatsnew/3.14.rst:2964 +#: ../../whatsnew/3.14.rst:2989 msgid ":c:func:`PyUnicodeWriter_Discard`" msgstr ":c:func:`PyUnicodeWriter_Discard`" -#: ../../whatsnew/3.14.rst:2965 +#: ../../whatsnew/3.14.rst:2990 msgid ":c:func:`PyUnicodeWriter_Finish`" msgstr ":c:func:`PyUnicodeWriter_Finish`" -#: ../../whatsnew/3.14.rst:2966 +#: ../../whatsnew/3.14.rst:2991 msgid ":c:func:`PyUnicodeWriter_Format`" msgstr ":c:func:`PyUnicodeWriter_Format`" -#: ../../whatsnew/3.14.rst:2967 +#: ../../whatsnew/3.14.rst:2992 msgid ":c:func:`PyUnicodeWriter_WriteASCII`" msgstr ":c:func:`PyUnicodeWriter_WriteASCII`" -#: ../../whatsnew/3.14.rst:2968 +#: ../../whatsnew/3.14.rst:2993 msgid ":c:func:`PyUnicodeWriter_WriteChar`" msgstr ":c:func:`PyUnicodeWriter_WriteChar`" -#: ../../whatsnew/3.14.rst:2969 +#: ../../whatsnew/3.14.rst:2994 msgid ":c:func:`PyUnicodeWriter_WriteRepr`" msgstr ":c:func:`PyUnicodeWriter_WriteRepr`" -#: ../../whatsnew/3.14.rst:2970 +#: ../../whatsnew/3.14.rst:2995 msgid ":c:func:`PyUnicodeWriter_WriteStr`" msgstr ":c:func:`PyUnicodeWriter_WriteStr`" -#: ../../whatsnew/3.14.rst:2971 +#: ../../whatsnew/3.14.rst:2996 msgid ":c:func:`PyUnicodeWriter_WriteSubstring`" msgstr ":c:func:`PyUnicodeWriter_WriteSubstring`" -#: ../../whatsnew/3.14.rst:2972 +#: ../../whatsnew/3.14.rst:2997 msgid ":c:func:`PyUnicodeWriter_WriteUCS4`" msgstr ":c:func:`PyUnicodeWriter_WriteUCS4`" -#: ../../whatsnew/3.14.rst:2973 +#: ../../whatsnew/3.14.rst:2998 msgid ":c:func:`PyUnicodeWriter_WriteUTF8`" msgstr ":c:func:`PyUnicodeWriter_WriteUTF8`" -#: ../../whatsnew/3.14.rst:2974 +#: ../../whatsnew/3.14.rst:2999 msgid ":c:func:`PyUnicodeWriter_WriteWideChar`" msgstr ":c:func:`PyUnicodeWriter_WriteWideChar`" -#: ../../whatsnew/3.14.rst:2976 +#: ../../whatsnew/3.14.rst:3001 msgid "(Contributed by Victor Stinner in :gh:`119182`.)" msgstr "(由 Victor Stinner 於 :gh:`119182` 貢獻。)" -#: ../../whatsnew/3.14.rst:2978 +#: ../../whatsnew/3.14.rst:3003 msgid "" "The ``k`` and ``K`` formats in :c:func:`PyArg_ParseTuple` and similar " "functions now use :meth:`~object.__index__` if available, like all other " "integer formats. (Contributed by Serhiy Storchaka in :gh:`112068`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2983 +#: ../../whatsnew/3.14.rst:3008 msgid "" "Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that " "produces a Python :class:`bool` object from a C integer. (Contributed by " "Pablo Galindo in :issue:`45325`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2987 +#: ../../whatsnew/3.14.rst:3012 msgid "" "Add :c:func:`PyUnstable_IsImmortal` for determining if an object is :term:" "`immortal`, for debugging purposes. (Contributed by Peter Bierma in :gh:" "`128509`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2991 +#: ../../whatsnew/3.14.rst:3016 msgid "" "Add :c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling deferred " "reference counting, as outlined in :pep:`703`." msgstr "" -#: ../../whatsnew/3.14.rst:2994 +#: ../../whatsnew/3.14.rst:3019 msgid "" "Add :c:func:`PyUnstable_Object_IsUniquelyReferenced` as a replacement for " "``Py_REFCNT(op) == 1`` on :term:`free threaded ` builds. " "(Contributed by Peter Bierma in :gh:`133140`.)" msgstr "" -#: ../../whatsnew/3.14.rst:2999 +#: ../../whatsnew/3.14.rst:3024 msgid "" "Add :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` to determine if " "an object is a unique temporary object on the interpreter's operand stack. " @@ -5652,11 +5682,11 @@ msgid "" "functions. (Contributed by Sam Gross in :gh:`133164`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3009 +#: ../../whatsnew/3.14.rst:3034 msgid "Limited C API changes" msgstr "" -#: ../../whatsnew/3.14.rst:3011 +#: ../../whatsnew/3.14.rst:3036 msgid "" "In the limited C API version 3.14 and newer, :c:func:`Py_TYPE` and :c:func:" "`Py_REFCNT` are now implemented as an opaque function call to hide " @@ -5664,7 +5694,7 @@ msgid "" "gh:`124127`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3016 +#: ../../whatsnew/3.14.rst:3041 msgid "" "Remove the :c:macro:`PySequence_Fast_GET_SIZE`, :c:macro:" "`PySequence_Fast_GET_ITEM`, and :c:macro:`PySequence_Fast_ITEMS` macros from " @@ -5672,32 +5702,32 @@ msgid "" "(Contributed by Victor Stinner in :gh:`91417`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3027 +#: ../../whatsnew/3.14.rst:3052 msgid "Removed C APIs" msgstr "被移除的 C API" -#: ../../whatsnew/3.14.rst:3029 +#: ../../whatsnew/3.14.rst:3054 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases was deprecated in Python 3.12, and now raises a :exc:`TypeError`. " "(Contributed by Nikita Sobolev in :gh:`119775`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3034 +#: ../../whatsnew/3.14.rst:3059 msgid "" "Remove ``PyDictObject.ma_version_tag`` member, which was deprecated in " "Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead. (Contributed " "by Sam Gross in :gh:`124296`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3039 +#: ../../whatsnew/3.14.rst:3064 msgid "" "Remove the private ``_Py_InitializeMain()`` function. It was a :term:" "`provisional API` added to Python 3.8 by :pep:`587`. (Contributed by Victor " "Stinner in :gh:`129033`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3043 +#: ../../whatsnew/3.14.rst:3068 msgid "" "Remove the undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and :c:member:" "`!PyThreadState.c_recursion_remaining`. These were added in 3.13 and have " @@ -5706,18 +5736,18 @@ msgid "" "`133079`, see also :gh:`130396`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3054 +#: ../../whatsnew/3.14.rst:3079 msgid "Deprecated C APIs" msgstr "已棄用的 C API" -#: ../../whatsnew/3.14.rst:3056 +#: ../../whatsnew/3.14.rst:3081 msgid "" "The :c:macro:`!Py_HUGE_VAL` macro is now :term:`soft deprecated`. Use :c:" "macro:`!Py_INFINITY` instead. (Contributed by Sergey B Kirpichev in :gh:" "`120026`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3060 +#: ../../whatsnew/3.14.rst:3085 msgid "" "The :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`, and :c:macro:`!" "Py_IS_FINITE` macros are now :term:`soft deprecated`. Use :c:macro:`!" @@ -5725,7 +5755,7 @@ msgid "" "file:`math.h` since C99. (Contributed by Sergey B Kirpichev in :gh:`119613`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3066 +#: ../../whatsnew/3.14.rst:3091 msgid "" "Non-tuple sequences are now deprecated as argument for the ``(items)`` " "format unit in :c:func:`PyArg_ParseTuple` and other :ref:`argument parsing " @@ -5734,14 +5764,14 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`50333`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3073 +#: ../../whatsnew/3.14.rst:3098 msgid "" "The ``_PyMonitoring_FireBranchEvent`` function is now deprecated and should " "be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:" "func:`PyMonitoring_FireBranchRightEvent`." msgstr "" -#: ../../whatsnew/3.14.rst:3078 +#: ../../whatsnew/3.14.rst:3103 msgid "" "The previously undocumented function :c:func:`PySequence_In` is now :term:" "`soft deprecated`. Use :c:func:`PySequence_Contains` instead. (Contributed " @@ -6365,11 +6395,11 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.14.rst:3097 +#: ../../whatsnew/3.14.rst:3122 msgid "Build changes" msgstr "建置變更" -#: ../../whatsnew/3.14.rst:3099 +#: ../../whatsnew/3.14.rst:3124 msgid "" ":pep:`776`: Emscripten is now an officially supported platform at :pep:`tier " "3 <11#tier-3>`. As a part of this effort, more than 25 bugs in `Emscripten " @@ -6379,31 +6409,31 @@ msgid "" "Chatham in :gh:`127146`, :gh:`127683`, and :gh:`136931`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3109 +#: ../../whatsnew/3.14.rst:3134 msgid "Official Android binary releases are now provided on python.org__." msgstr "" -#: ../../whatsnew/3.14.rst:3113 +#: ../../whatsnew/3.14.rst:3138 msgid "" "GNU Autoconf 2.72 is now required to generate :file:`configure`. " "(Contributed by Erlend Aasland in :gh:`115765`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3116 +#: ../../whatsnew/3.14.rst:3141 msgid "" "``wasm32-unknown-emscripten`` is now a :pep:`11` tier 3 platform. " "(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, and :gh:" "`136931`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3119 +#: ../../whatsnew/3.14.rst:3144 msgid "" "``#pragma``-based linking with ``python3*.lib`` can now be switched off " "with :c:expr:`Py_NO_LINK_LIB`. (Contributed by Jean-Christophe Fillion-Robin " "in :gh:`82909`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3123 +#: ../../whatsnew/3.14.rst:3148 msgid "" "CPython now enables a set of recommended compiler options by default for " "improved security. Use the :option:`--disable-safety` :file:`configure` " @@ -6411,45 +6441,45 @@ msgid "" "larger set of compiler options, albeit with a performance cost." msgstr "" -#: ../../whatsnew/3.14.rst:3129 +#: ../../whatsnew/3.14.rst:3154 msgid "" "The ``WITH_FREELISTS`` macro and ``--without-freelists`` :file:`configure` " "option have been removed." msgstr "" -#: ../../whatsnew/3.14.rst:3132 +#: ../../whatsnew/3.14.rst:3157 msgid "" "The new :file:`configure` option :option:`--with-tail-call-interp` may be " "used to enable the experimental tail call interpreter. See :ref:`whatsnew314-" "tail-call-interpreter` for further details." msgstr "" -#: ../../whatsnew/3.14.rst:3136 +#: ../../whatsnew/3.14.rst:3161 msgid "" "To disable the new remote debugging support, use the :option:`--without-" "remote-debug` :file:`configure` option. This may be useful for security " "reasons." msgstr "" -#: ../../whatsnew/3.14.rst:3140 +#: ../../whatsnew/3.14.rst:3165 msgid "" "iOS and macOS apps can now be configured to redirect ``stdout`` and " "``stderr`` content to the system log. (Contributed by Russell Keith-Magee " "in :gh:`127592`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3144 +#: ../../whatsnew/3.14.rst:3169 msgid "" "The iOS testbed is now able to stream test output while the test is running. " "The testbed can also be used to run the test suite of projects other than " "CPython itself. (Contributed by Russell Keith-Magee in :gh:`127592`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3153 +#: ../../whatsnew/3.14.rst:3178 msgid ":file:`build-details.json`" msgstr ":file:`build-details.json`" -#: ../../whatsnew/3.14.rst:3155 +#: ../../whatsnew/3.14.rst:3180 msgid "" "Installations of Python now contain a new file, :file:`build-details.json`. " "This is a static JSON document containing build details for CPython, to " @@ -6457,7 +6487,7 @@ msgid "" "cases such as Python launchers, cross-compilation, and so on." msgstr "" -#: ../../whatsnew/3.14.rst:3161 +#: ../../whatsnew/3.14.rst:3186 msgid "" ":file:`build-details.json` must be installed in the platform-independent " "standard library directory. This corresponds to the :ref:`'stdlib' " @@ -6465,17 +6495,17 @@ msgid "" "by running ``sysconfig.get_path('stdlib')``." msgstr "" -#: ../../whatsnew/3.14.rst:3167 +#: ../../whatsnew/3.14.rst:3192 msgid "" ":pep:`739` -- ``build-details.json`` 1.0 -- a static description file for " "Python build details" msgstr "" -#: ../../whatsnew/3.14.rst:3174 +#: ../../whatsnew/3.14.rst:3199 msgid "Discontinuation of PGP signatures" msgstr "" -#: ../../whatsnew/3.14.rst:3176 +#: ../../whatsnew/3.14.rst:3201 msgid "" "PGP (Pretty Good Privacy) signatures will not be provided for releases of " "Python 3.14 or future versions. To verify CPython artifacts, users must use " @@ -6483,15 +6513,15 @@ msgid "" "sigstore/>`__. Releases have been signed using Sigstore_ since Python 3.11." msgstr "" -#: ../../whatsnew/3.14.rst:3182 +#: ../../whatsnew/3.14.rst:3207 msgid "This change in release process was specified in :pep:`761`." msgstr "" -#: ../../whatsnew/3.14.rst:3190 +#: ../../whatsnew/3.14.rst:3215 msgid "Free-threaded Python is officially supported" msgstr "" -#: ../../whatsnew/3.14.rst:3192 +#: ../../whatsnew/3.14.rst:3217 msgid "" "The free-threaded build of Python is now supported and no longer " "experimental. This is the start of `phase II `__, with free-threading as the default or sole build of Python is " @@ -6522,19 +6552,19 @@ msgid "" "and the community. This decision is for the future." msgstr "" -#: ../../whatsnew/3.14.rst:3212 +#: ../../whatsnew/3.14.rst:3237 msgid ":pep:`779`" msgstr ":pep:`779`" -#: ../../whatsnew/3.14.rst:3214 +#: ../../whatsnew/3.14.rst:3239 msgid "`PEP 779's acceptance `__" msgstr "`PEP 779 的接受 `__" -#: ../../whatsnew/3.14.rst:3220 +#: ../../whatsnew/3.14.rst:3245 msgid "Binary releases for the experimental just-in-time compiler" msgstr "" -#: ../../whatsnew/3.14.rst:3222 +#: ../../whatsnew/3.14.rst:3247 msgid "" "The official macOS and Windows release binaries now include an " "*experimental* just-in-time (JIT) compiler. Although it is **not** " @@ -6544,7 +6574,7 @@ msgid "" "off` configuration option for similar behavior." msgstr "" -#: ../../whatsnew/3.14.rst:3229 +#: ../../whatsnew/3.14.rst:3254 msgid "" "The JIT is at an early stage and still in active development. As such, the " "typical performance impact of enabling it can range from 10% slower to 20% " @@ -6556,7 +6586,7 @@ msgid "" "current process." msgstr "" -#: ../../whatsnew/3.14.rst:3237 +#: ../../whatsnew/3.14.rst:3262 msgid "" "Currently, the most significant missing functionality is that native " "debuggers and profilers like ``gdb`` and ``perf`` are unable to unwind " @@ -6565,83 +6595,83 @@ msgid "" "not support JIT compilation." msgstr "" -#: ../../whatsnew/3.14.rst:3242 +#: ../../whatsnew/3.14.rst:3267 msgid "" "Please report any bugs or major performance regressions that you encounter!" msgstr "" -#: ../../whatsnew/3.14.rst:3244 +#: ../../whatsnew/3.14.rst:3269 msgid ":pep:`744`" msgstr ":pep:`744`" -#: ../../whatsnew/3.14.rst:3248 +#: ../../whatsnew/3.14.rst:3273 msgid "Porting to Python 3.14" msgstr "移植至 Python 3.14" -#: ../../whatsnew/3.14.rst:3250 +#: ../../whatsnew/3.14.rst:3275 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.14.rst:3255 +#: ../../whatsnew/3.14.rst:3280 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.14.rst:3257 +#: ../../whatsnew/3.14.rst:3282 msgid "" "On Unix platforms other than macOS, *forkserver* is now the default :ref:" "`start method ` for :mod:`multiprocessing` " "and :class:`~concurrent.futures.ProcessPoolExecutor`, instead of *fork*." msgstr "" -#: ../../whatsnew/3.14.rst:3261 +#: ../../whatsnew/3.14.rst:3286 msgid "" "See :ref:`(1) ` and :ref:`(2) " "` for details." msgstr "" -#: ../../whatsnew/3.14.rst:3264 +#: ../../whatsnew/3.14.rst:3289 msgid "" "If you encounter :exc:`NameError`\\s or pickling errors coming out of :mod:" "`multiprocessing` or :mod:`concurrent.futures`, see the :ref:`forkserver " "restrictions `." msgstr "" -#: ../../whatsnew/3.14.rst:3268 +#: ../../whatsnew/3.14.rst:3293 msgid "" "This change does not affect Windows or macOS, where :ref:`'spawn' " "` remains the default start method." msgstr "" -#: ../../whatsnew/3.14.rst:3271 +#: ../../whatsnew/3.14.rst:3296 msgid "" ":class:`functools.partial` is now a method descriptor. Wrap it in :func:" "`staticmethod` if you want to preserve the old behavior. (Contributed by " "Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3275 +#: ../../whatsnew/3.14.rst:3300 msgid "" "The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" msgstr "" -#: ../../whatsnew/3.14.rst:3282 +#: ../../whatsnew/3.14.rst:3307 msgid "" "The :func:`locale.nl_langinfo` function now temporarily sets the " "``LC_CTYPE`` locale in some cases. This temporary change affects other " "threads. (Contributed by Serhiy Storchaka in :gh:`69998`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3287 +#: ../../whatsnew/3.14.rst:3312 msgid "" ":class:`types.UnionType` is now an alias for :class:`typing.Union`, causing " "changes in some behaviors. See :ref:`above ` for " "more details. (Contributed by Jelle Zijlstra in :gh:`105499`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3292 +#: ../../whatsnew/3.14.rst:3317 msgid "" "The runtime behavior of annotations has changed in various ways; see :ref:" "`above ` for details. While most code that " @@ -6649,29 +6679,29 @@ msgid "" "details may behave differently." msgstr "" -#: ../../whatsnew/3.14.rst:3297 +#: ../../whatsnew/3.14.rst:3322 msgid "" "As part of making the :mod:`mimetypes` CLI public, it now exits with ``1`` " "on failure instead of ``0`` and ``2`` on incorrect command-line parameters " "instead of ``1``. Error messages are now printed to stderr." msgstr "" -#: ../../whatsnew/3.14.rst:3302 +#: ../../whatsnew/3.14.rst:3327 msgid "" "The ``\\B`` pattern in regular expression now matches the empty string when " "given as the entire pattern, which may cause behavioural changes." msgstr "" -#: ../../whatsnew/3.14.rst:3305 +#: ../../whatsnew/3.14.rst:3330 msgid "" "On FreeBSD, :data:`sys.platform` no longer contains the major version number." msgstr "" -#: ../../whatsnew/3.14.rst:3311 +#: ../../whatsnew/3.14.rst:3336 msgid "Changes in annotations (:pep:`649` and :pep:`749`)" msgstr "" -#: ../../whatsnew/3.14.rst:3313 +#: ../../whatsnew/3.14.rst:3338 msgid "" "This section contains guidance on changes that may be needed to annotations " "or Python code that interacts with or introspects annotations, due to the " @@ -6679,24 +6709,24 @@ msgid "" "deferred-annotations>`." msgstr "" -#: ../../whatsnew/3.14.rst:3318 +#: ../../whatsnew/3.14.rst:3343 msgid "" "In the majority of cases, working code from older versions of Python will " "not require any changes." msgstr "" -#: ../../whatsnew/3.14.rst:3323 +#: ../../whatsnew/3.14.rst:3348 msgid "Implications for annotated code" msgstr "" -#: ../../whatsnew/3.14.rst:3325 +#: ../../whatsnew/3.14.rst:3350 msgid "" "If you define annotations in your code (for example, for use with a static " "type checker), then this change probably does not affect you: you can keep " "writing annotations the same way you did with previous versions of Python." msgstr "" -#: ../../whatsnew/3.14.rst:3329 +#: ../../whatsnew/3.14.rst:3354 msgid "" "You will likely be able to remove quoted strings in annotations, which are " "frequently used for forward references. Similarly, if you use ``from " @@ -6707,11 +6737,11 @@ msgid "" "annotations before they work as expected." msgstr "" -#: ../../whatsnew/3.14.rst:3339 +#: ../../whatsnew/3.14.rst:3364 msgid "Implications for readers of ``__annotations__``" msgstr "" -#: ../../whatsnew/3.14.rst:3341 +#: ../../whatsnew/3.14.rst:3366 msgid "" "If your code reads the :attr:`~object.__annotations__` attribute on objects, " "you may want to make changes in order to support code that relies on " @@ -6720,7 +6750,7 @@ msgid "" "FORWARDREF` format, as the :mod:`dataclasses` module now does." msgstr "" -#: ../../whatsnew/3.14.rst:3348 +#: ../../whatsnew/3.14.rst:3373 msgid "" "The external :pypi:`typing_extensions` package provides partial backports of " "some of the functionality of the :mod:`annotationlib` module, such as the :" @@ -6729,11 +6759,11 @@ msgid "" "that takes advantage of the new behavior in Python 3.14." msgstr "" -#: ../../whatsnew/3.14.rst:3357 +#: ../../whatsnew/3.14.rst:3382 msgid "Related changes" msgstr "" -#: ../../whatsnew/3.14.rst:3359 +#: ../../whatsnew/3.14.rst:3384 msgid "" "The changes in Python 3.14 are designed to rework how :attr:`!" "__annotations__` works at runtime while minimizing breakage to code that " @@ -6745,7 +6775,7 @@ msgid "" "the :mod:`annotationlib` module." msgstr "" -#: ../../whatsnew/3.14.rst:3368 +#: ../../whatsnew/3.14.rst:3393 msgid "" "In particular, do not read annotations directly from the namespace " "dictionary attribute of type objects. Use :func:`annotationlib." @@ -6753,25 +6783,25 @@ msgid "" "`annotationlib.get_annotations` afterwards." msgstr "" -#: ../../whatsnew/3.14.rst:3373 +#: ../../whatsnew/3.14.rst:3398 msgid "" "In previous releases, it was sometimes possible to access class annotations " "from an instance of an annotated class. This behavior was undocumented and " "accidental, and will no longer work in Python 3.14." msgstr "" -#: ../../whatsnew/3.14.rst:3379 +#: ../../whatsnew/3.14.rst:3404 msgid "``from __future__ import annotations``" msgstr "``from __future__ import annotations``" -#: ../../whatsnew/3.14.rst:3381 +#: ../../whatsnew/3.14.rst:3406 msgid "" "In Python 3.7, :pep:`563` introduced the ``from __future__ import " "annotations`` :ref:`future statement `, which turns all annotations " "into strings." msgstr "" -#: ../../whatsnew/3.14.rst:3384 +#: ../../whatsnew/3.14.rst:3409 msgid "" "However, this statement is now deprecated and it is expected to be removed " "in a future version of Python. This removal will not happen until after " @@ -6779,17 +6809,17 @@ msgid "" "Python without support for deferred evaluation of annotations." msgstr "" -#: ../../whatsnew/3.14.rst:3390 +#: ../../whatsnew/3.14.rst:3415 msgid "" "In Python 3.14, the behavior of code using ``from __future__ import " "annotations`` is unchanged." msgstr "" -#: ../../whatsnew/3.14.rst:3395 +#: ../../whatsnew/3.14.rst:3420 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.14.rst:3397 +#: ../../whatsnew/3.14.rst:3422 msgid "" ":c:func:`Py_Finalize` now deletes all interned strings. This is backwards " "incompatible to any C extension that holds onto an interned string after a " @@ -6802,14 +6832,14 @@ msgid "" "`113601`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3407 +#: ../../whatsnew/3.14.rst:3432 msgid "" "The :ref:`Unicode Exception Objects ` C API now raises a :" "exc:`TypeError` if its exception argument is not a :exc:`UnicodeError` " "object. (Contributed by Bénédikt Tran in :gh:`127691`.)" msgstr "" -#: ../../whatsnew/3.14.rst:3414 +#: ../../whatsnew/3.14.rst:3439 msgid "" "The interpreter internally avoids some reference count modifications when " "loading objects onto the operands stack by :term:`borrowing `__ of " +"significant memory pressure in production environments. See :ref:" +"`whatsnew314-incremental-gc` for details." +msgstr "" + #~ msgid "Delegation of ``int()`` to ``__trunc__()`` method." #~ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。"