From 1232886ef58dde312ab5d48738a5fc7e5a9b72a1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Nov 2025 00:15:15 +0000 Subject: [PATCH 1/2] sync with cpython 5dc8ecc5 --- c-api/exceptions.po | 439 ++++++++++++++++++++++++-------------------- 1 file changed, 241 insertions(+), 198 deletions(-) diff --git a/c-api/exceptions.po b/c-api/exceptions.po index c98d7ad7d2..09c06cdfe2 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -7,7 +7,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: 2025-11-08 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -416,16 +416,23 @@ msgstr "" #: ../../c-api/exceptions.rst:399 msgid "" +"Similar to :c:func:`PyErr_WarnExplicit`, but uses :c:func:" +"`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" +"encoded string." +msgstr "" + +#: ../../c-api/exceptions.rst:408 +msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" -#: ../../c-api/exceptions.rst:406 +#: ../../c-api/exceptions.rst:415 msgid "Querying the error indicator" msgstr "" -#: ../../c-api/exceptions.rst:410 +#: ../../c-api/exceptions.rst:419 msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " @@ -434,11 +441,11 @@ msgid "" "`Py_DECREF` it." msgstr "" -#: ../../c-api/exceptions.rst:416 +#: ../../c-api/exceptions.rst:425 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/exceptions.rst:420 +#: ../../c-api/exceptions.rst:429 msgid "" "Do not compare the return value to a specific exception; use :c:func:" "`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " @@ -446,14 +453,14 @@ msgid "" "of a class exception, or it may be a subclass of the expected exception.)" msgstr "" -#: ../../c-api/exceptions.rst:428 +#: ../../c-api/exceptions.rst:437 msgid "" "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " "should only be called when an exception is actually set; a memory access " "violation will occur if no exception has been raised." msgstr "" -#: ../../c-api/exceptions.rst:435 +#: ../../c-api/exceptions.rst:444 msgid "" "Return true if the *given* exception matches the exception type in *exc*. " "If *exc* is a class object, this also returns true when *given* is an " @@ -461,23 +468,23 @@ msgid "" "tuple (and recursively in subtuples) are searched for a match." msgstr "" -#: ../../c-api/exceptions.rst:443 +#: ../../c-api/exceptions.rst:452 msgid "" "Return the exception currently being raised, clearing the error indicator at " "the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -#: ../../c-api/exceptions.rst:446 +#: ../../c-api/exceptions.rst:455 msgid "" "This function is used by code that needs to catch exceptions, or code that " "needs to save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:449 ../../c-api/exceptions.rst:493 +#: ../../c-api/exceptions.rst:458 ../../c-api/exceptions.rst:502 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/exceptions.rst:451 +#: ../../c-api/exceptions.rst:460 msgid "" "{\n" " PyObject *exc = PyErr_GetRaisedException();\n" @@ -495,27 +502,27 @@ msgstr "" " PyErr_SetRaisedException(exc);\n" "}" -#: ../../c-api/exceptions.rst:459 +#: ../../c-api/exceptions.rst:468 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" -#: ../../c-api/exceptions.rst:467 +#: ../../c-api/exceptions.rst:476 msgid "" "Set *exc* as the exception currently being raised, clearing the existing " "exception if one is set." msgstr "" -#: ../../c-api/exceptions.rst:472 +#: ../../c-api/exceptions.rst:481 msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: ../../c-api/exceptions.rst:481 +#: ../../c-api/exceptions.rst:490 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../c-api/exceptions.rst:483 +#: ../../c-api/exceptions.rst:492 msgid "" "Retrieve the error indicator into three variables whose addresses are " "passed. If the error indicator is not set, set all three variables to " @@ -524,13 +531,13 @@ msgid "" "the type object is not." msgstr "" -#: ../../c-api/exceptions.rst:490 +#: ../../c-api/exceptions.rst:499 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:495 +#: ../../c-api/exceptions.rst:504 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -550,11 +557,11 @@ msgstr "" " PyErr_Restore(type, value, traceback);\n" "}" -#: ../../c-api/exceptions.rst:509 +#: ../../c-api/exceptions.rst:518 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../c-api/exceptions.rst:511 +#: ../../c-api/exceptions.rst:520 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -567,20 +574,20 @@ msgid "" "don't use this function. I warned you.)" msgstr "" -#: ../../c-api/exceptions.rst:525 +#: ../../c-api/exceptions.rst:534 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" -#: ../../c-api/exceptions.rst:534 +#: ../../c-api/exceptions.rst:543 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" -#: ../../c-api/exceptions.rst:537 +#: ../../c-api/exceptions.rst:546 msgid "" "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " "below can be \"unnormalized\", meaning that ``*exc`` is a class object but " @@ -590,14 +597,14 @@ msgid "" "improve performance." msgstr "" -#: ../../c-api/exceptions.rst:545 +#: ../../c-api/exceptions.rst:554 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" -#: ../../c-api/exceptions.rst:550 +#: ../../c-api/exceptions.rst:559 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" @@ -607,7 +614,7 @@ msgstr "" " PyException_SetTraceback(val, tb);\n" "}" -#: ../../c-api/exceptions.rst:557 +#: ../../c-api/exceptions.rst:566 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " @@ -615,7 +622,7 @@ msgid "" "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" -#: ../../c-api/exceptions.rst:564 +#: ../../c-api/exceptions.rst:573 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -623,14 +630,14 @@ msgid "" "clear the exception state." msgstr "" -#: ../../c-api/exceptions.rst:573 +#: ../../c-api/exceptions.rst:582 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:580 +#: ../../c-api/exceptions.rst:589 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -638,7 +645,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:589 +#: ../../c-api/exceptions.rst:598 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -648,7 +655,7 @@ msgid "" "using :c:func:`PyErr_GetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:598 +#: ../../c-api/exceptions.rst:607 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -656,7 +663,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:608 +#: ../../c-api/exceptions.rst:617 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " @@ -666,7 +673,7 @@ msgid "" "`PyErr_SetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:617 +#: ../../c-api/exceptions.rst:626 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -674,22 +681,22 @@ msgid "" "state." msgstr "" -#: ../../c-api/exceptions.rst:624 +#: ../../c-api/exceptions.rst:633 msgid "" "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " "The interpreter now derives them from the exception instance (the ``value`` " "argument). The function still steals references of all three arguments." msgstr "" -#: ../../c-api/exceptions.rst:632 +#: ../../c-api/exceptions.rst:641 msgid "Signal Handling" msgstr "訊號處理" -#: ../../c-api/exceptions.rst:642 +#: ../../c-api/exceptions.rst:651 msgid "This function interacts with Python's signal handling." msgstr "" -#: ../../c-api/exceptions.rst:644 +#: ../../c-api/exceptions.rst:653 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -697,7 +704,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: ../../c-api/exceptions.rst:649 +#: ../../c-api/exceptions.rst:658 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -706,44 +713,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: ../../c-api/exceptions.rst:655 +#: ../../c-api/exceptions.rst:664 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: ../../c-api/exceptions.rst:658 +#: ../../c-api/exceptions.rst:667 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: ../../c-api/exceptions.rst:662 +#: ../../c-api/exceptions.rst:671 msgid "" "The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:673 +#: ../../c-api/exceptions.rst:682 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: ../../c-api/exceptions.rst:677 ../../c-api/exceptions.rst:704 +#: ../../c-api/exceptions.rst:686 ../../c-api/exceptions.rst:713 msgid "" "This function is async-signal-safe. It can be called without an :term:" "`attached thread state` and from a C signal handler." msgstr "" -#: ../../c-api/exceptions.rst:687 +#: ../../c-api/exceptions.rst:696 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: ../../c-api/exceptions.rst:691 +#: ../../c-api/exceptions.rst:700 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -751,27 +758,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: ../../c-api/exceptions.rst:696 +#: ../../c-api/exceptions.rst:705 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: ../../c-api/exceptions.rst:699 +#: ../../c-api/exceptions.rst:708 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: ../../c-api/exceptions.rst:712 +#: ../../c-api/exceptions.rst:721 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: ../../c-api/exceptions.rst:716 +#: ../../c-api/exceptions.rst:725 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -779,15 +786,15 @@ msgid "" "be called from the main thread." msgstr "" -#: ../../c-api/exceptions.rst:721 +#: ../../c-api/exceptions.rst:730 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../c-api/exceptions.rst:726 +#: ../../c-api/exceptions.rst:735 msgid "Exception Classes" msgstr "例外類別" -#: ../../c-api/exceptions.rst:730 +#: ../../c-api/exceptions.rst:739 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -796,7 +803,7 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: ../../c-api/exceptions.rst:736 +#: ../../c-api/exceptions.rst:745 msgid "" "The :attr:`~type.__module__` attribute of the new class is set to the first " "part (up to the last dot) of the *name* argument, and the class name is set " @@ -806,41 +813,41 @@ msgid "" "variables and methods." msgstr "" -#: ../../c-api/exceptions.rst:745 +#: ../../c-api/exceptions.rst:754 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: ../../c-api/exceptions.rst:754 +#: ../../c-api/exceptions.rst:763 msgid "" "Return non-zero if *ob* is an exception class, zero otherwise. This function " "always succeeds." msgstr "" -#: ../../c-api/exceptions.rst:759 +#: ../../c-api/exceptions.rst:768 msgid "Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*." msgstr "回傳例外類別 *ob* 的 :c:member:`~PyTypeObject.tp_name`。" -#: ../../c-api/exceptions.rst:763 +#: ../../c-api/exceptions.rst:772 msgid "Exception Objects" msgstr "例外物件" -#: ../../c-api/exceptions.rst:767 +#: ../../c-api/exceptions.rst:776 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through the :attr:`~BaseException.__traceback__` " "attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:775 +#: ../../c-api/exceptions.rst:784 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: ../../c-api/exceptions.rst:781 +#: ../../c-api/exceptions.rst:790 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -848,14 +855,14 @@ msgid "" "there is no context associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:789 +#: ../../c-api/exceptions.rst:798 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: ../../c-api/exceptions.rst:796 +#: ../../c-api/exceptions.rst:805 msgid "" "Return the cause (either an exception instance, or ``None``, set by " "``raise ... from ...``) associated with the exception as a new reference, as " @@ -863,28 +870,28 @@ msgid "" "attribute." msgstr "" -#: ../../c-api/exceptions.rst:804 +#: ../../c-api/exceptions.rst:813 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:808 +#: ../../c-api/exceptions.rst:817 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" -#: ../../c-api/exceptions.rst:814 +#: ../../c-api/exceptions.rst:823 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "回傳例外 *ex* 的 :attr:`~BaseException.args`。" -#: ../../c-api/exceptions.rst:819 +#: ../../c-api/exceptions.rst:828 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "設定例外 *ex* 的 :attr:`~BaseException.args` 為 *args*。" -#: ../../c-api/exceptions.rst:823 +#: ../../c-api/exceptions.rst:832 msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " @@ -896,98 +903,98 @@ msgid "" "if there is nothing to reraise." msgstr "" -#: ../../c-api/exceptions.rst:837 +#: ../../c-api/exceptions.rst:846 msgid "Unicode Exception Objects" msgstr "Unicode 例外物件" -#: ../../c-api/exceptions.rst:839 +#: ../../c-api/exceptions.rst:848 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: ../../c-api/exceptions.rst:843 +#: ../../c-api/exceptions.rst:852 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: ../../c-api/exceptions.rst:850 +#: ../../c-api/exceptions.rst:859 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:856 +#: ../../c-api/exceptions.rst:865 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:862 +#: ../../c-api/exceptions.rst:871 msgid "" "Get the *start* attribute of the given exception object and place it into " "*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: ../../c-api/exceptions.rst:866 +#: ../../c-api/exceptions.rst:875 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting " "*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." msgstr "" -#: ../../c-api/exceptions.rst:869 +#: ../../c-api/exceptions.rst:878 msgid ":attr:`UnicodeError.start`" msgstr ":attr:`UnicodeError.start`" -#: ../../c-api/exceptions.rst:875 +#: ../../c-api/exceptions.rst:884 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:880 +#: ../../c-api/exceptions.rst:889 msgid "" "While passing a negative *start* does not raise an exception, the " "corresponding getters will not consider it as a relative offset." msgstr "" -#: ../../c-api/exceptions.rst:888 +#: ../../c-api/exceptions.rst:897 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:892 +#: ../../c-api/exceptions.rst:901 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " "is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." msgstr "" -#: ../../c-api/exceptions.rst:899 +#: ../../c-api/exceptions.rst:908 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:902 +#: ../../c-api/exceptions.rst:911 msgid ":attr:`UnicodeError.end`" msgstr ":attr:`UnicodeError.end`" -#: ../../c-api/exceptions.rst:908 +#: ../../c-api/exceptions.rst:917 msgid "Return the *reason* attribute of the given exception object." msgstr "回傳給定例外物件的 *reason* 屬性。" -#: ../../c-api/exceptions.rst:914 +#: ../../c-api/exceptions.rst:923 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:921 +#: ../../c-api/exceptions.rst:930 msgid "Recursion Control" msgstr "遞迴控制" -#: ../../c-api/exceptions.rst:923 +#: ../../c-api/exceptions.rst:932 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -997,37 +1004,37 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:932 +#: ../../c-api/exceptions.rst:941 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:934 +#: ../../c-api/exceptions.rst:943 msgid "" "The function then checks if the stack limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:938 +#: ../../c-api/exceptions.rst:947 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:942 ../../c-api/exceptions.rst:950 +#: ../../c-api/exceptions.rst:951 ../../c-api/exceptions.rst:959 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: ../../c-api/exceptions.rst:947 +#: ../../c-api/exceptions.rst:956 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:953 +#: ../../c-api/exceptions.rst:962 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -1036,13 +1043,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:961 +#: ../../c-api/exceptions.rst:970 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:964 +#: ../../c-api/exceptions.rst:973 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -1050,301 +1057,301 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:970 +#: ../../c-api/exceptions.rst:979 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:974 +#: ../../c-api/exceptions.rst:983 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:979 +#: ../../c-api/exceptions.rst:988 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:984 +#: ../../c-api/exceptions.rst:993 msgid "" "Get the recursion limit for the current interpreter. It can be set with :c:" "func:`Py_SetRecursionLimit`. The recursion limit prevents the Python " "interpreter stack from growing infinitely." msgstr "" -#: ../../c-api/exceptions.rst:988 ../../c-api/exceptions.rst:998 +#: ../../c-api/exceptions.rst:997 ../../c-api/exceptions.rst:1007 msgid "" "This function cannot fail, and the caller must hold an :term:`attached " "thread state`." msgstr "" -#: ../../c-api/exceptions.rst:992 +#: ../../c-api/exceptions.rst:1001 msgid ":py:func:`sys.getrecursionlimit`" msgstr ":py:func:`sys.getrecursionlimit`" -#: ../../c-api/exceptions.rst:996 +#: ../../c-api/exceptions.rst:1005 msgid "Set the recursion limit for the current interpreter." msgstr "" -#: ../../c-api/exceptions.rst:1002 +#: ../../c-api/exceptions.rst:1011 msgid ":py:func:`sys.setrecursionlimit`" msgstr ":py:func:`sys.setrecursionlimit`" -#: ../../c-api/exceptions.rst:1007 +#: ../../c-api/exceptions.rst:1016 msgid "Exception and warning types" msgstr "例外和警告型別" -#: ../../c-api/exceptions.rst:1009 +#: ../../c-api/exceptions.rst:1018 msgid "" "All standard Python exceptions and warning categories are available as " "global variables whose names are ``PyExc_`` followed by the Python exception " "name. These have the type :c:expr:`PyObject*`; they are all class objects." msgstr "" -#: ../../c-api/exceptions.rst:1013 +#: ../../c-api/exceptions.rst:1022 msgid "For completeness, here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1025 msgid "Exception types" msgstr "例外型別" -#: ../../c-api/exceptions.rst:1023 ../../c-api/exceptions.rst:1169 -#: ../../c-api/exceptions.rst:1199 +#: ../../c-api/exceptions.rst:1032 ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1208 msgid "C name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:1024 ../../c-api/exceptions.rst:1170 -#: ../../c-api/exceptions.rst:1200 +#: ../../c-api/exceptions.rst:1033 ../../c-api/exceptions.rst:1179 +#: ../../c-api/exceptions.rst:1209 msgid "Python name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:1026 +#: ../../c-api/exceptions.rst:1035 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:1028 +#: ../../c-api/exceptions.rst:1037 msgid ":exc:`BaseExceptionGroup`" msgstr ":exc:`BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:1030 +#: ../../c-api/exceptions.rst:1039 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1041 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1034 +#: ../../c-api/exceptions.rst:1043 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1036 +#: ../../c-api/exceptions.rst:1045 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1047 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1040 +#: ../../c-api/exceptions.rst:1049 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1042 +#: ../../c-api/exceptions.rst:1051 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1044 +#: ../../c-api/exceptions.rst:1053 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1046 +#: ../../c-api/exceptions.rst:1055 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1048 +#: ../../c-api/exceptions.rst:1057 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1050 +#: ../../c-api/exceptions.rst:1059 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1052 +#: ../../c-api/exceptions.rst:1061 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1054 +#: ../../c-api/exceptions.rst:1063 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1056 +#: ../../c-api/exceptions.rst:1065 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1058 +#: ../../c-api/exceptions.rst:1067 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1060 +#: ../../c-api/exceptions.rst:1069 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1062 +#: ../../c-api/exceptions.rst:1071 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1064 +#: ../../c-api/exceptions.rst:1073 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1066 +#: ../../c-api/exceptions.rst:1075 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:1077 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1079 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1081 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1083 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1085 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1087 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1089 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1091 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1093 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1095 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1097 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1090 ../../c-api/exceptions.rst:1173 -#: ../../c-api/exceptions.rst:1176 ../../c-api/exceptions.rst:1179 +#: ../../c-api/exceptions.rst:1099 ../../c-api/exceptions.rst:1182 +#: ../../c-api/exceptions.rst:1185 ../../c-api/exceptions.rst:1188 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1092 +#: ../../c-api/exceptions.rst:1101 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1094 +#: ../../c-api/exceptions.rst:1103 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1105 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1098 +#: ../../c-api/exceptions.rst:1107 msgid ":exc:`PythonFinalizationError`" msgstr ":exc:`PythonFinalizationError`" -#: ../../c-api/exceptions.rst:1100 +#: ../../c-api/exceptions.rst:1109 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1102 +#: ../../c-api/exceptions.rst:1111 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1104 +#: ../../c-api/exceptions.rst:1113 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1106 +#: ../../c-api/exceptions.rst:1115 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1108 +#: ../../c-api/exceptions.rst:1117 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1110 +#: ../../c-api/exceptions.rst:1119 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1112 +#: ../../c-api/exceptions.rst:1121 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1114 +#: ../../c-api/exceptions.rst:1123 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1125 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1118 +#: ../../c-api/exceptions.rst:1127 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1120 +#: ../../c-api/exceptions.rst:1129 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1122 +#: ../../c-api/exceptions.rst:1131 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1124 +#: ../../c-api/exceptions.rst:1133 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1126 +#: ../../c-api/exceptions.rst:1135 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1128 +#: ../../c-api/exceptions.rst:1137 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1130 +#: ../../c-api/exceptions.rst:1139 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1132 +#: ../../c-api/exceptions.rst:1141 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1134 +#: ../../c-api/exceptions.rst:1143 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1136 +#: ../../c-api/exceptions.rst:1145 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1364,128 +1371,164 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1146 +#: ../../c-api/exceptions.rst:1155 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1158 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1152 +#: ../../c-api/exceptions.rst:1161 msgid ":c:data:`PyExc_BaseExceptionGroup`." msgstr ":c:data:`PyExc_BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:1157 +#: ../../c-api/exceptions.rst:1166 msgid "OSError aliases" msgstr "OSError 別名" -#: ../../c-api/exceptions.rst:1159 +#: ../../c-api/exceptions.rst:1168 msgid "The following are a compatibility aliases to :c:data:`PyExc_OSError`." msgstr "" -#: ../../c-api/exceptions.rst:1161 +#: ../../c-api/exceptions.rst:1170 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1171 +#: ../../c-api/exceptions.rst:1180 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1180 +#: ../../c-api/exceptions.rst:1189 msgid "[win]_" msgstr "[win]_" -#: ../../c-api/exceptions.rst:1182 +#: ../../c-api/exceptions.rst:1191 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1185 +#: ../../c-api/exceptions.rst:1194 msgid "" ":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that " "uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1201 msgid "Warning types" msgstr "警告型別" -#: ../../c-api/exceptions.rst:1202 +#: ../../c-api/exceptions.rst:1211 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1204 +#: ../../c-api/exceptions.rst:1213 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1206 +#: ../../c-api/exceptions.rst:1215 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1217 msgid ":exc:`EncodingWarning`" msgstr ":exc:`EncodingWarning`" -#: ../../c-api/exceptions.rst:1210 +#: ../../c-api/exceptions.rst:1219 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1212 +#: ../../c-api/exceptions.rst:1221 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1214 +#: ../../c-api/exceptions.rst:1223 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1216 +#: ../../c-api/exceptions.rst:1225 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1218 +#: ../../c-api/exceptions.rst:1227 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1220 +#: ../../c-api/exceptions.rst:1229 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1222 +#: ../../c-api/exceptions.rst:1231 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1224 +#: ../../c-api/exceptions.rst:1233 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1226 +#: ../../c-api/exceptions.rst:1235 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`。" -#: ../../c-api/exceptions.rst:1229 +#: ../../c-api/exceptions.rst:1238 msgid ":c:data:`PyExc_EncodingWarning`." msgstr ":c:data:`PyExc_EncodingWarning`。" +#: ../../c-api/exceptions.rst:1243 +msgid "Tracebacks" +msgstr "" + +#: ../../c-api/exceptions.rst:1247 +msgid "" +"Type object for traceback objects. This is available as :class:`types." +"TracebackType` in the Python layer." +msgstr "" + +#: ../../c-api/exceptions.rst:1253 +msgid "" +"Return true if *op* is a traceback object, false otherwise. This function " +"does not account for subtypes." +msgstr "" + +#: ../../c-api/exceptions.rst:1259 +msgid "" +"Replace the :attr:`~BaseException.__traceback__` attribute on the current " +"exception with a new traceback prepending *f* to the existing chain." +msgstr "" + +#: ../../c-api/exceptions.rst:1262 +msgid "Calling this function without an exception set is undefined behavior." +msgstr "" + +#: ../../c-api/exceptions.rst:1264 ../../c-api/exceptions.rst:1272 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." +msgstr "" + +#: ../../c-api/exceptions.rst:1270 +msgid "Write the traceback *tb* into the file *f*." +msgstr "" + #: ../../c-api/exceptions.rst:183 msgid "strerror (C function)" msgstr "strerror(C 函式)" -#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 -#: ../../c-api/exceptions.rst:683 +#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 +#: ../../c-api/exceptions.rst:692 msgid "module" msgstr "module(模組)" -#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 -#: ../../c-api/exceptions.rst:683 +#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 +#: ../../c-api/exceptions.rst:692 msgid "signal" msgstr "signal(訊號)" -#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 msgid "SIGINT (C macro)" msgstr "SIGINT(C 巨集)" -#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 -#: ../../c-api/exceptions.rst:683 +#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 +#: ../../c-api/exceptions.rst:692 msgid "KeyboardInterrupt (built-in exception)" msgstr "KeyboardInterrupt(內建例外)" From b95f2cfb5f8a4964d5da9517ba3e1e4a977cd477 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 9 Nov 2025 00:19:09 +0000 Subject: [PATCH 2/2] sync with cpython d8a2b8a4 --- c-api/buffer.po | 164 ++++---- c-api/exceptions.po | 449 +++++++++++---------- c-api/hash.po | 119 ++++-- c-api/intro.po | 710 +++++++++++++++++---------------- library/json.po | 475 +++++++++++----------- library/sys.po | 937 ++++++++++++++++++++++---------------------- library/time.po | 11 +- 7 files changed, 1498 insertions(+), 1367 deletions(-) diff --git a/c-api/buffer.po b/c-api/buffer.po index 2307ed3d90..c53ee22c8e 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-02 00:15+0000\n" +"POT-Creation-Date: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -362,12 +362,16 @@ msgid "" msgstr "" #: ../../c-api/buffer.rst:266 +msgid "This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`." +msgstr "" + +#: ../../c-api/buffer.rst:270 msgid "" "Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be " "filled in correctly. Otherwise, this field MUST be ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:270 +#: ../../c-api/buffer.rst:274 msgid "" ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " "section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:" @@ -375,159 +379,159 @@ msgid "" "writable buffer." msgstr "" -#: ../../c-api/buffer.rst:274 +#: ../../c-api/buffer.rst:278 msgid "" ":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" "`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " "bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:280 +#: ../../c-api/buffer.rst:284 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:282 +#: ../../c-api/buffer.rst:286 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:317 +#: ../../c-api/buffer.rst:342 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:317 +#: ../../c-api/buffer.rst:342 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:317 +#: ../../c-api/buffer.rst:342 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:317 +#: ../../c-api/buffer.rst:342 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:293 -#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:315 -#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 -#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:297 +#: ../../c-api/buffer.rst:299 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:323 +#: ../../c-api/buffer.rst:325 ../../c-api/buffer.rst:344 #: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 #: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 -#: ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:354 ../../c-api/buffer.rst:356 +#: ../../c-api/buffer.rst:358 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:346 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:295 -#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:315 -#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 -#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:344 -#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:299 +#: ../../c-api/buffer.rst:301 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:323 +#: ../../c-api/buffer.rst:325 ../../c-api/buffer.rst:348 #: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 -#: ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:354 ../../c-api/buffer.rst:356 +#: ../../c-api/buffer.rst:358 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:304 +#: ../../c-api/buffer.rst:308 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:306 +#: ../../c-api/buffer.rst:310 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:313 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:342 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:321 -#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:319 ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:356 ../../c-api/buffer.rst:358 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:317 +#: ../../c-api/buffer.rst:321 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:323 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:325 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:326 +#: ../../c-api/buffer.rst:330 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:328 +#: ../../c-api/buffer.rst:332 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:336 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:342 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:342 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 #: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 #: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:350 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:344 -#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:356 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 -#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:354 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:350 +#: ../../c-api/buffer.rst:354 ../../c-api/buffer.rst:358 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:359 +#: ../../c-api/buffer.rst:363 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:362 +#: ../../c-api/buffer.rst:366 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:364 +#: ../../c-api/buffer.rst:368 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:367 +#: ../../c-api/buffer.rst:371 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -535,14 +539,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:371 +#: ../../c-api/buffer.rst:375 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:375 +#: ../../c-api/buffer.rst:379 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -552,14 +556,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:381 +#: ../../c-api/buffer.rst:385 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:385 +#: ../../c-api/buffer.rst:389 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -588,11 +592,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:415 +#: ../../c-api/buffer.rst:419 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:417 +#: ../../c-api/buffer.rst:421 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -603,14 +607,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:426 +#: ../../c-api/buffer.rst:430 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:430 +#: ../../c-api/buffer.rst:434 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -638,25 +642,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:445 +#: ../../c-api/buffer.rst:449 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:449 +#: ../../c-api/buffer.rst:453 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:456 +#: ../../c-api/buffer.rst:460 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:461 +#: ../../c-api/buffer.rst:465 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -664,7 +668,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: ../../c-api/buffer.rst:466 +#: ../../c-api/buffer.rst:470 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -672,7 +676,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:474 +#: ../../c-api/buffer.rst:478 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -680,19 +684,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:479 +#: ../../c-api/buffer.rst:483 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:485 +#: ../../c-api/buffer.rst:489 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:493 +#: ../../c-api/buffer.rst:497 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -700,69 +704,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:500 +#: ../../c-api/buffer.rst:504 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:506 +#: ../../c-api/buffer.rst:510 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:513 +#: ../../c-api/buffer.rst:517 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:517 +#: ../../c-api/buffer.rst:521 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:522 +#: ../../c-api/buffer.rst:526 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:525 +#: ../../c-api/buffer.rst:529 msgid "``0`` is returned on success, ``-1`` on error." msgstr "成功時回傳 ``0``,錯誤時回傳 ``-1``。" -#: ../../c-api/buffer.rst:529 +#: ../../c-api/buffer.rst:533 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:536 +#: ../../c-api/buffer.rst:540 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:540 +#: ../../c-api/buffer.rst:544 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:544 +#: ../../c-api/buffer.rst:548 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:548 +#: ../../c-api/buffer.rst:552 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -789,14 +793,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:301 +#: ../../c-api/buffer.rst:305 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:301 +#: ../../c-api/buffer.rst:305 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:301 +#: ../../c-api/buffer.rst:305 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 09c06cdfe2..f05ed3acbc 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-11-08 00:13+0000\n" +"POT-Creation-Date: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -346,11 +346,30 @@ msgid "" "use." msgstr "" -#: ../../c-api/exceptions.rst:335 +#: ../../c-api/exceptions.rst:336 +msgid "" +"Get the source line in *filename* at line *lineno*. *filename* should be a " +"Python :class:`str` object." +msgstr "" + +#: ../../c-api/exceptions.rst:339 +msgid "" +"On success, this function returns a Python string object with the found " +"line. On failure, this function returns ``NULL`` without an exception set." +msgstr "" + +#: ../../c-api/exceptions.rst:345 +msgid "" +"Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a :c:expr:" +"`const char *`, which is decoded with the :term:`filesystem encoding and " +"error handler`, instead of a Python object reference." +msgstr "" + +#: ../../c-api/exceptions.rst:352 msgid "Issuing warnings" msgstr "" -#: ../../c-api/exceptions.rst:337 +#: ../../c-api/exceptions.rst:354 msgid "" "Use these functions to issue warnings from C code. They mirror similar " "functions exported by the Python :mod:`warnings` module. They normally " @@ -366,7 +385,7 @@ msgid "" "return an error value)." msgstr "" -#: ../../c-api/exceptions.rst:352 +#: ../../c-api/exceptions.rst:369 msgid "" "Issue a warning message. The *category* argument is a warning category (see " "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " @@ -376,7 +395,7 @@ msgid "" "`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -#: ../../c-api/exceptions.rst:359 +#: ../../c-api/exceptions.rst:376 msgid "" "Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" "`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " @@ -385,14 +404,14 @@ msgid "" "enumerated at :ref:`standardwarningcategories`." msgstr "" -#: ../../c-api/exceptions.rst:365 +#: ../../c-api/exceptions.rst:382 msgid "" "For information about warning control, see the documentation for the :mod:" "`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" -#: ../../c-api/exceptions.rst:372 +#: ../../c-api/exceptions.rst:389 msgid "" "Issue a warning message with explicit control over all warning attributes. " "This is a straightforward wrapper around the Python function :func:`warnings." @@ -400,39 +419,39 @@ msgid "" "arguments may be set to ``NULL`` to get the default effect described there." msgstr "" -#: ../../c-api/exceptions.rst:383 +#: ../../c-api/exceptions.rst:400 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " "*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:390 +#: ../../c-api/exceptions.rst:407 msgid "" "Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" "`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" "encoded string." msgstr "" -#: ../../c-api/exceptions.rst:399 +#: ../../c-api/exceptions.rst:416 msgid "" "Similar to :c:func:`PyErr_WarnExplicit`, but uses :c:func:" "`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" "encoded string." msgstr "" -#: ../../c-api/exceptions.rst:408 +#: ../../c-api/exceptions.rst:425 msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" -#: ../../c-api/exceptions.rst:415 +#: ../../c-api/exceptions.rst:432 msgid "Querying the error indicator" msgstr "" -#: ../../c-api/exceptions.rst:419 +#: ../../c-api/exceptions.rst:436 msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " @@ -441,11 +460,11 @@ msgid "" "`Py_DECREF` it." msgstr "" -#: ../../c-api/exceptions.rst:425 +#: ../../c-api/exceptions.rst:442 msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: ../../c-api/exceptions.rst:429 +#: ../../c-api/exceptions.rst:446 msgid "" "Do not compare the return value to a specific exception; use :c:func:" "`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " @@ -453,14 +472,14 @@ msgid "" "of a class exception, or it may be a subclass of the expected exception.)" msgstr "" -#: ../../c-api/exceptions.rst:437 +#: ../../c-api/exceptions.rst:454 msgid "" "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " "should only be called when an exception is actually set; a memory access " "violation will occur if no exception has been raised." msgstr "" -#: ../../c-api/exceptions.rst:444 +#: ../../c-api/exceptions.rst:461 msgid "" "Return true if the *given* exception matches the exception type in *exc*. " "If *exc* is a class object, this also returns true when *given* is an " @@ -468,23 +487,23 @@ msgid "" "tuple (and recursively in subtuples) are searched for a match." msgstr "" -#: ../../c-api/exceptions.rst:452 +#: ../../c-api/exceptions.rst:469 msgid "" "Return the exception currently being raised, clearing the error indicator at " "the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -#: ../../c-api/exceptions.rst:455 +#: ../../c-api/exceptions.rst:472 msgid "" "This function is used by code that needs to catch exceptions, or code that " "needs to save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:458 ../../c-api/exceptions.rst:502 +#: ../../c-api/exceptions.rst:475 ../../c-api/exceptions.rst:519 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/exceptions.rst:460 +#: ../../c-api/exceptions.rst:477 msgid "" "{\n" " PyObject *exc = PyErr_GetRaisedException();\n" @@ -502,27 +521,27 @@ msgstr "" " PyErr_SetRaisedException(exc);\n" "}" -#: ../../c-api/exceptions.rst:468 +#: ../../c-api/exceptions.rst:485 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" -#: ../../c-api/exceptions.rst:476 +#: ../../c-api/exceptions.rst:493 msgid "" "Set *exc* as the exception currently being raised, clearing the existing " "exception if one is set." msgstr "" -#: ../../c-api/exceptions.rst:481 +#: ../../c-api/exceptions.rst:498 msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: ../../c-api/exceptions.rst:490 +#: ../../c-api/exceptions.rst:507 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../c-api/exceptions.rst:492 +#: ../../c-api/exceptions.rst:509 msgid "" "Retrieve the error indicator into three variables whose addresses are " "passed. If the error indicator is not set, set all three variables to " @@ -531,13 +550,13 @@ msgid "" "the type object is not." msgstr "" -#: ../../c-api/exceptions.rst:499 +#: ../../c-api/exceptions.rst:516 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:504 +#: ../../c-api/exceptions.rst:521 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -557,11 +576,11 @@ msgstr "" " PyErr_Restore(type, value, traceback);\n" "}" -#: ../../c-api/exceptions.rst:518 +#: ../../c-api/exceptions.rst:535 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../c-api/exceptions.rst:520 +#: ../../c-api/exceptions.rst:537 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -574,20 +593,20 @@ msgid "" "don't use this function. I warned you.)" msgstr "" -#: ../../c-api/exceptions.rst:534 +#: ../../c-api/exceptions.rst:551 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" -#: ../../c-api/exceptions.rst:543 +#: ../../c-api/exceptions.rst:560 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" -#: ../../c-api/exceptions.rst:546 +#: ../../c-api/exceptions.rst:563 msgid "" "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " "below can be \"unnormalized\", meaning that ``*exc`` is a class object but " @@ -597,14 +616,14 @@ msgid "" "improve performance." msgstr "" -#: ../../c-api/exceptions.rst:554 +#: ../../c-api/exceptions.rst:571 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" -#: ../../c-api/exceptions.rst:559 +#: ../../c-api/exceptions.rst:576 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" @@ -614,7 +633,7 @@ msgstr "" " PyException_SetTraceback(val, tb);\n" "}" -#: ../../c-api/exceptions.rst:566 +#: ../../c-api/exceptions.rst:583 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " @@ -622,7 +641,7 @@ msgid "" "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" -#: ../../c-api/exceptions.rst:573 +#: ../../c-api/exceptions.rst:590 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -630,14 +649,14 @@ msgid "" "clear the exception state." msgstr "" -#: ../../c-api/exceptions.rst:582 +#: ../../c-api/exceptions.rst:599 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:589 +#: ../../c-api/exceptions.rst:606 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -645,7 +664,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:598 +#: ../../c-api/exceptions.rst:615 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -655,7 +674,7 @@ msgid "" "using :c:func:`PyErr_GetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:607 +#: ../../c-api/exceptions.rst:624 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -663,7 +682,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:617 +#: ../../c-api/exceptions.rst:634 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " @@ -673,7 +692,7 @@ msgid "" "`PyErr_SetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:626 +#: ../../c-api/exceptions.rst:643 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -681,22 +700,22 @@ msgid "" "state." msgstr "" -#: ../../c-api/exceptions.rst:633 +#: ../../c-api/exceptions.rst:650 msgid "" "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " "The interpreter now derives them from the exception instance (the ``value`` " "argument). The function still steals references of all three arguments." msgstr "" -#: ../../c-api/exceptions.rst:641 +#: ../../c-api/exceptions.rst:658 msgid "Signal Handling" msgstr "訊號處理" -#: ../../c-api/exceptions.rst:651 +#: ../../c-api/exceptions.rst:668 msgid "This function interacts with Python's signal handling." msgstr "" -#: ../../c-api/exceptions.rst:653 +#: ../../c-api/exceptions.rst:670 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -704,7 +723,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: ../../c-api/exceptions.rst:658 +#: ../../c-api/exceptions.rst:675 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -713,44 +732,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: ../../c-api/exceptions.rst:664 +#: ../../c-api/exceptions.rst:681 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: ../../c-api/exceptions.rst:667 +#: ../../c-api/exceptions.rst:684 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: ../../c-api/exceptions.rst:671 +#: ../../c-api/exceptions.rst:688 msgid "" "The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:682 +#: ../../c-api/exceptions.rst:699 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: ../../c-api/exceptions.rst:686 ../../c-api/exceptions.rst:713 +#: ../../c-api/exceptions.rst:703 ../../c-api/exceptions.rst:730 msgid "" "This function is async-signal-safe. It can be called without an :term:" "`attached thread state` and from a C signal handler." msgstr "" -#: ../../c-api/exceptions.rst:696 +#: ../../c-api/exceptions.rst:713 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: ../../c-api/exceptions.rst:700 +#: ../../c-api/exceptions.rst:717 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -758,27 +777,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: ../../c-api/exceptions.rst:705 +#: ../../c-api/exceptions.rst:722 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: ../../c-api/exceptions.rst:708 +#: ../../c-api/exceptions.rst:725 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: ../../c-api/exceptions.rst:721 +#: ../../c-api/exceptions.rst:738 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: ../../c-api/exceptions.rst:725 +#: ../../c-api/exceptions.rst:742 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -786,15 +805,15 @@ msgid "" "be called from the main thread." msgstr "" -#: ../../c-api/exceptions.rst:730 +#: ../../c-api/exceptions.rst:747 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../c-api/exceptions.rst:735 +#: ../../c-api/exceptions.rst:752 msgid "Exception Classes" msgstr "例外類別" -#: ../../c-api/exceptions.rst:739 +#: ../../c-api/exceptions.rst:756 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -803,7 +822,7 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: ../../c-api/exceptions.rst:745 +#: ../../c-api/exceptions.rst:762 msgid "" "The :attr:`~type.__module__` attribute of the new class is set to the first " "part (up to the last dot) of the *name* argument, and the class name is set " @@ -813,41 +832,41 @@ msgid "" "variables and methods." msgstr "" -#: ../../c-api/exceptions.rst:754 +#: ../../c-api/exceptions.rst:771 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: ../../c-api/exceptions.rst:763 +#: ../../c-api/exceptions.rst:780 msgid "" "Return non-zero if *ob* is an exception class, zero otherwise. This function " "always succeeds." msgstr "" -#: ../../c-api/exceptions.rst:768 +#: ../../c-api/exceptions.rst:785 msgid "Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*." msgstr "回傳例外類別 *ob* 的 :c:member:`~PyTypeObject.tp_name`。" -#: ../../c-api/exceptions.rst:772 +#: ../../c-api/exceptions.rst:789 msgid "Exception Objects" msgstr "例外物件" -#: ../../c-api/exceptions.rst:776 +#: ../../c-api/exceptions.rst:793 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through the :attr:`~BaseException.__traceback__` " "attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:784 +#: ../../c-api/exceptions.rst:801 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: ../../c-api/exceptions.rst:790 +#: ../../c-api/exceptions.rst:807 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -855,14 +874,14 @@ msgid "" "there is no context associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:798 +#: ../../c-api/exceptions.rst:815 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: ../../c-api/exceptions.rst:805 +#: ../../c-api/exceptions.rst:822 msgid "" "Return the cause (either an exception instance, or ``None``, set by " "``raise ... from ...``) associated with the exception as a new reference, as " @@ -870,28 +889,28 @@ msgid "" "attribute." msgstr "" -#: ../../c-api/exceptions.rst:813 +#: ../../c-api/exceptions.rst:830 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:817 +#: ../../c-api/exceptions.rst:834 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" -#: ../../c-api/exceptions.rst:823 +#: ../../c-api/exceptions.rst:840 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "回傳例外 *ex* 的 :attr:`~BaseException.args`。" -#: ../../c-api/exceptions.rst:828 +#: ../../c-api/exceptions.rst:845 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "設定例外 *ex* 的 :attr:`~BaseException.args` 為 *args*。" -#: ../../c-api/exceptions.rst:832 +#: ../../c-api/exceptions.rst:849 msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " @@ -903,98 +922,98 @@ msgid "" "if there is nothing to reraise." msgstr "" -#: ../../c-api/exceptions.rst:846 +#: ../../c-api/exceptions.rst:863 msgid "Unicode Exception Objects" msgstr "Unicode 例外物件" -#: ../../c-api/exceptions.rst:848 +#: ../../c-api/exceptions.rst:865 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: ../../c-api/exceptions.rst:852 +#: ../../c-api/exceptions.rst:869 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: ../../c-api/exceptions.rst:859 +#: ../../c-api/exceptions.rst:876 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:865 +#: ../../c-api/exceptions.rst:882 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:871 +#: ../../c-api/exceptions.rst:888 msgid "" "Get the *start* attribute of the given exception object and place it into " "*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: ../../c-api/exceptions.rst:875 +#: ../../c-api/exceptions.rst:892 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting " "*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." msgstr "" -#: ../../c-api/exceptions.rst:878 +#: ../../c-api/exceptions.rst:895 msgid ":attr:`UnicodeError.start`" msgstr ":attr:`UnicodeError.start`" -#: ../../c-api/exceptions.rst:884 +#: ../../c-api/exceptions.rst:901 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:889 +#: ../../c-api/exceptions.rst:906 msgid "" "While passing a negative *start* does not raise an exception, the " "corresponding getters will not consider it as a relative offset." msgstr "" -#: ../../c-api/exceptions.rst:897 +#: ../../c-api/exceptions.rst:914 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:901 +#: ../../c-api/exceptions.rst:918 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " "is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." msgstr "" -#: ../../c-api/exceptions.rst:908 +#: ../../c-api/exceptions.rst:925 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:911 +#: ../../c-api/exceptions.rst:928 msgid ":attr:`UnicodeError.end`" msgstr ":attr:`UnicodeError.end`" -#: ../../c-api/exceptions.rst:917 +#: ../../c-api/exceptions.rst:934 msgid "Return the *reason* attribute of the given exception object." msgstr "回傳給定例外物件的 *reason* 屬性。" -#: ../../c-api/exceptions.rst:923 +#: ../../c-api/exceptions.rst:940 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:930 +#: ../../c-api/exceptions.rst:947 msgid "Recursion Control" msgstr "遞迴控制" -#: ../../c-api/exceptions.rst:932 +#: ../../c-api/exceptions.rst:949 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -1004,37 +1023,37 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:941 +#: ../../c-api/exceptions.rst:958 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:943 +#: ../../c-api/exceptions.rst:960 msgid "" "The function then checks if the stack limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:947 +#: ../../c-api/exceptions.rst:964 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:951 ../../c-api/exceptions.rst:959 +#: ../../c-api/exceptions.rst:968 ../../c-api/exceptions.rst:976 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: ../../c-api/exceptions.rst:956 +#: ../../c-api/exceptions.rst:973 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:962 +#: ../../c-api/exceptions.rst:979 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -1043,13 +1062,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:970 +#: ../../c-api/exceptions.rst:987 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:973 +#: ../../c-api/exceptions.rst:990 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -1057,301 +1076,301 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:979 +#: ../../c-api/exceptions.rst:996 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:983 +#: ../../c-api/exceptions.rst:1000 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:988 +#: ../../c-api/exceptions.rst:1005 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:993 +#: ../../c-api/exceptions.rst:1010 msgid "" "Get the recursion limit for the current interpreter. It can be set with :c:" "func:`Py_SetRecursionLimit`. The recursion limit prevents the Python " "interpreter stack from growing infinitely." msgstr "" -#: ../../c-api/exceptions.rst:997 ../../c-api/exceptions.rst:1007 +#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1024 msgid "" "This function cannot fail, and the caller must hold an :term:`attached " "thread state`." msgstr "" -#: ../../c-api/exceptions.rst:1001 +#: ../../c-api/exceptions.rst:1018 msgid ":py:func:`sys.getrecursionlimit`" msgstr ":py:func:`sys.getrecursionlimit`" -#: ../../c-api/exceptions.rst:1005 +#: ../../c-api/exceptions.rst:1022 msgid "Set the recursion limit for the current interpreter." msgstr "" -#: ../../c-api/exceptions.rst:1011 +#: ../../c-api/exceptions.rst:1028 msgid ":py:func:`sys.setrecursionlimit`" msgstr ":py:func:`sys.setrecursionlimit`" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1033 msgid "Exception and warning types" msgstr "例外和警告型別" -#: ../../c-api/exceptions.rst:1018 +#: ../../c-api/exceptions.rst:1035 msgid "" "All standard Python exceptions and warning categories are available as " "global variables whose names are ``PyExc_`` followed by the Python exception " "name. These have the type :c:expr:`PyObject*`; they are all class objects." msgstr "" -#: ../../c-api/exceptions.rst:1022 +#: ../../c-api/exceptions.rst:1039 msgid "For completeness, here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1025 +#: ../../c-api/exceptions.rst:1042 msgid "Exception types" msgstr "例外型別" -#: ../../c-api/exceptions.rst:1032 ../../c-api/exceptions.rst:1178 -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1049 ../../c-api/exceptions.rst:1195 +#: ../../c-api/exceptions.rst:1225 msgid "C name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:1033 ../../c-api/exceptions.rst:1179 -#: ../../c-api/exceptions.rst:1209 +#: ../../c-api/exceptions.rst:1050 ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1226 msgid "Python name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:1035 +#: ../../c-api/exceptions.rst:1052 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:1037 +#: ../../c-api/exceptions.rst:1054 msgid ":exc:`BaseExceptionGroup`" msgstr ":exc:`BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:1039 +#: ../../c-api/exceptions.rst:1056 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:1041 +#: ../../c-api/exceptions.rst:1058 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1060 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1045 +#: ../../c-api/exceptions.rst:1062 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1047 +#: ../../c-api/exceptions.rst:1064 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1049 +#: ../../c-api/exceptions.rst:1066 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1051 +#: ../../c-api/exceptions.rst:1068 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1053 +#: ../../c-api/exceptions.rst:1070 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1055 +#: ../../c-api/exceptions.rst:1072 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1057 +#: ../../c-api/exceptions.rst:1074 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1059 +#: ../../c-api/exceptions.rst:1076 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1061 +#: ../../c-api/exceptions.rst:1078 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1063 +#: ../../c-api/exceptions.rst:1080 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1065 +#: ../../c-api/exceptions.rst:1082 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1067 +#: ../../c-api/exceptions.rst:1084 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1069 +#: ../../c-api/exceptions.rst:1086 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1071 +#: ../../c-api/exceptions.rst:1088 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1073 +#: ../../c-api/exceptions.rst:1090 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1075 +#: ../../c-api/exceptions.rst:1092 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1077 +#: ../../c-api/exceptions.rst:1094 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1079 +#: ../../c-api/exceptions.rst:1096 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1081 +#: ../../c-api/exceptions.rst:1098 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1083 +#: ../../c-api/exceptions.rst:1100 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1085 +#: ../../c-api/exceptions.rst:1102 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1087 +#: ../../c-api/exceptions.rst:1104 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1089 +#: ../../c-api/exceptions.rst:1106 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1091 +#: ../../c-api/exceptions.rst:1108 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1093 +#: ../../c-api/exceptions.rst:1110 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1095 +#: ../../c-api/exceptions.rst:1112 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1097 +#: ../../c-api/exceptions.rst:1114 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1099 ../../c-api/exceptions.rst:1182 -#: ../../c-api/exceptions.rst:1185 ../../c-api/exceptions.rst:1188 +#: ../../c-api/exceptions.rst:1116 ../../c-api/exceptions.rst:1199 +#: ../../c-api/exceptions.rst:1202 ../../c-api/exceptions.rst:1205 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1101 +#: ../../c-api/exceptions.rst:1118 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1103 +#: ../../c-api/exceptions.rst:1120 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1105 +#: ../../c-api/exceptions.rst:1122 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1107 +#: ../../c-api/exceptions.rst:1124 msgid ":exc:`PythonFinalizationError`" msgstr ":exc:`PythonFinalizationError`" -#: ../../c-api/exceptions.rst:1109 +#: ../../c-api/exceptions.rst:1126 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1111 +#: ../../c-api/exceptions.rst:1128 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1113 +#: ../../c-api/exceptions.rst:1130 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1115 +#: ../../c-api/exceptions.rst:1132 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1117 +#: ../../c-api/exceptions.rst:1134 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1119 +#: ../../c-api/exceptions.rst:1136 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1121 +#: ../../c-api/exceptions.rst:1138 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1123 +#: ../../c-api/exceptions.rst:1140 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1125 +#: ../../c-api/exceptions.rst:1142 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1127 +#: ../../c-api/exceptions.rst:1144 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1129 +#: ../../c-api/exceptions.rst:1146 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1131 +#: ../../c-api/exceptions.rst:1148 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1133 +#: ../../c-api/exceptions.rst:1150 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1135 +#: ../../c-api/exceptions.rst:1152 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1137 +#: ../../c-api/exceptions.rst:1154 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1139 +#: ../../c-api/exceptions.rst:1156 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1158 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1143 +#: ../../c-api/exceptions.rst:1160 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1145 +#: ../../c-api/exceptions.rst:1162 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1371,141 +1390,141 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1155 +#: ../../c-api/exceptions.rst:1172 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1158 +#: ../../c-api/exceptions.rst:1175 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1161 +#: ../../c-api/exceptions.rst:1178 msgid ":c:data:`PyExc_BaseExceptionGroup`." msgstr ":c:data:`PyExc_BaseExceptionGroup`" -#: ../../c-api/exceptions.rst:1166 +#: ../../c-api/exceptions.rst:1183 msgid "OSError aliases" msgstr "OSError 別名" -#: ../../c-api/exceptions.rst:1168 +#: ../../c-api/exceptions.rst:1185 msgid "The following are a compatibility aliases to :c:data:`PyExc_OSError`." msgstr "" -#: ../../c-api/exceptions.rst:1170 +#: ../../c-api/exceptions.rst:1187 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1180 +#: ../../c-api/exceptions.rst:1197 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1189 +#: ../../c-api/exceptions.rst:1206 msgid "[win]_" msgstr "[win]_" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1208 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1211 msgid "" ":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that " "uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1201 +#: ../../c-api/exceptions.rst:1218 msgid "Warning types" msgstr "警告型別" -#: ../../c-api/exceptions.rst:1211 +#: ../../c-api/exceptions.rst:1228 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1213 +#: ../../c-api/exceptions.rst:1230 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1215 +#: ../../c-api/exceptions.rst:1232 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1217 +#: ../../c-api/exceptions.rst:1234 msgid ":exc:`EncodingWarning`" msgstr ":exc:`EncodingWarning`" -#: ../../c-api/exceptions.rst:1219 +#: ../../c-api/exceptions.rst:1236 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1221 +#: ../../c-api/exceptions.rst:1238 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1223 +#: ../../c-api/exceptions.rst:1240 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1225 +#: ../../c-api/exceptions.rst:1242 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1227 +#: ../../c-api/exceptions.rst:1244 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1229 +#: ../../c-api/exceptions.rst:1246 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1231 +#: ../../c-api/exceptions.rst:1248 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1233 +#: ../../c-api/exceptions.rst:1250 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1235 +#: ../../c-api/exceptions.rst:1252 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`。" -#: ../../c-api/exceptions.rst:1238 +#: ../../c-api/exceptions.rst:1255 msgid ":c:data:`PyExc_EncodingWarning`." msgstr ":c:data:`PyExc_EncodingWarning`。" -#: ../../c-api/exceptions.rst:1243 +#: ../../c-api/exceptions.rst:1260 msgid "Tracebacks" msgstr "" -#: ../../c-api/exceptions.rst:1247 +#: ../../c-api/exceptions.rst:1264 msgid "" "Type object for traceback objects. This is available as :class:`types." "TracebackType` in the Python layer." msgstr "" -#: ../../c-api/exceptions.rst:1253 +#: ../../c-api/exceptions.rst:1270 msgid "" "Return true if *op* is a traceback object, false otherwise. This function " "does not account for subtypes." msgstr "" -#: ../../c-api/exceptions.rst:1259 +#: ../../c-api/exceptions.rst:1276 msgid "" "Replace the :attr:`~BaseException.__traceback__` attribute on the current " "exception with a new traceback prepending *f* to the existing chain." msgstr "" -#: ../../c-api/exceptions.rst:1262 +#: ../../c-api/exceptions.rst:1279 msgid "Calling this function without an exception set is undefined behavior." msgstr "" -#: ../../c-api/exceptions.rst:1264 ../../c-api/exceptions.rst:1272 +#: ../../c-api/exceptions.rst:1281 ../../c-api/exceptions.rst:1289 msgid "" "This function returns ``0`` on success, and returns ``-1`` with an exception " "set on failure." msgstr "" -#: ../../c-api/exceptions.rst:1270 +#: ../../c-api/exceptions.rst:1287 msgid "Write the traceback *tb* into the file *f*." msgstr "" @@ -1513,22 +1532,22 @@ msgstr "" msgid "strerror (C function)" msgstr "strerror(C 函式)" -#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 -#: ../../c-api/exceptions.rst:692 +#: ../../c-api/exceptions.rst:663 ../../c-api/exceptions.rst:694 +#: ../../c-api/exceptions.rst:709 msgid "module" msgstr "module(模組)" -#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 -#: ../../c-api/exceptions.rst:692 +#: ../../c-api/exceptions.rst:663 ../../c-api/exceptions.rst:694 +#: ../../c-api/exceptions.rst:709 msgid "signal" msgstr "signal(訊號)" -#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 +#: ../../c-api/exceptions.rst:663 ../../c-api/exceptions.rst:694 msgid "SIGINT (C macro)" msgstr "SIGINT(C 巨集)" -#: ../../c-api/exceptions.rst:646 ../../c-api/exceptions.rst:677 -#: ../../c-api/exceptions.rst:692 +#: ../../c-api/exceptions.rst:663 ../../c-api/exceptions.rst:694 +#: ../../c-api/exceptions.rst:709 msgid "KeyboardInterrupt (built-in exception)" msgstr "KeyboardInterrupt(內建例外)" diff --git a/c-api/hash.po b/c-api/hash.po index cbd53b8163..020fd33cf3 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-12 00:14+0000\n" +"POT-Creation-Date: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,11 +30,62 @@ msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員和 :ref:`numeric-ha msgid "Hash value type: signed integer." msgstr "雜湊值型別:有符號整數。" -#: ../../c-api/hash.rst:16 +#: ../../c-api/hash.rst:17 msgid "Hash value type: unsigned integer." msgstr "雜湊值型別:無符號整數。" -#: ../../c-api/hash.rst:22 +#: ../../c-api/hash.rst:24 +msgid "" +"A numerical value indicating the algorithm for hashing of :class:`str`, :" +"class:`bytes`, and :class:`memoryview`." +msgstr "" + +#: ../../c-api/hash.rst:27 +msgid "The algorithm name is exposed by :data:`sys.hash_info.algorithm`." +msgstr "" + +#: ../../c-api/hash.rst:36 +msgid "" +"Numerical values to compare to :c:macro:`Py_HASH_ALGORITHM` to determine " +"which algorithm is used for hashing. The hash algorithm can be configured " +"via the configure :option:`--with-hash-algorithm` option." +msgstr "" + +#: ../../c-api/hash.rst:40 +msgid "Add :c:macro:`!Py_HASH_FNV` and :c:macro:`!Py_HASH_SIPHASH24`." +msgstr "" + +#: ../../c-api/hash.rst:43 +msgid "Add :c:macro:`!Py_HASH_SIPHASH13`." +msgstr "" + +#: ../../c-api/hash.rst:49 +msgid "" +"Buffers of length in range ``[1, Py_HASH_CUTOFF)`` are hashed using DJBX33A " +"instead of the algorithm described by :c:macro:`Py_HASH_ALGORITHM`." +msgstr "" + +#: ../../c-api/hash.rst:52 +msgid "A :c:macro:`!Py_HASH_CUTOFF` of 0 disables the optimization." +msgstr "" + +#: ../../c-api/hash.rst:53 +msgid "" +":c:macro:`!Py_HASH_CUTOFF` must be non-negative and less or equal than 7." +msgstr "" + +#: ../../c-api/hash.rst:55 +msgid "" +"32-bit platforms should use a cutoff smaller than 64-bit platforms because " +"it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms " +"and 5 on 32-bit platforms should provide a decent safety margin." +msgstr "" + +#: ../../c-api/hash.rst:59 +msgid "This corresponds to the :data:`sys.hash_info.cutoff` constant." +msgstr "" + +#: ../../c-api/hash.rst:66 msgid "" "The `Mersenne prime `_ ``P = " "2**n -1``, used for numeric hash scheme." @@ -42,53 +93,77 @@ msgstr "" "用於數值雜湊方案的\\ `梅森質數 (Mersenne prime) `_ ``P = 2**n -1``。" -#: ../../c-api/hash.rst:28 +#: ../../c-api/hash.rst:69 +msgid "This corresponds to the :data:`sys.hash_info.modulus` constant." +msgstr "" + +#: ../../c-api/hash.rst:76 msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." msgstr ":c:macro:`PyHASH_MODULUS` 中 ``P`` 的指數 ``n``。" -#: ../../c-api/hash.rst:34 +#: ../../c-api/hash.rst:83 msgid "Prime multiplier used in string and various other hashes." msgstr "用於字串和其他各種雜湊的質數乘數 (prime multiplier)。" -#: ../../c-api/hash.rst:40 +#: ../../c-api/hash.rst:90 msgid "The hash value returned for a positive infinity." msgstr "正無窮大回傳的雜湊值。" -#: ../../c-api/hash.rst:46 +#: ../../c-api/hash.rst:92 +msgid "This corresponds to the :data:`sys.hash_info.inf` constant." +msgstr "" + +#: ../../c-api/hash.rst:99 msgid "The multiplier used for the imaginary part of a complex number." msgstr "用於複數虛數部分的乘數。" -#: ../../c-api/hash.rst:52 +#: ../../c-api/hash.rst:101 +msgid "This corresponds to the :data:`sys.hash_info.imag` constant." +msgstr "" + +#: ../../c-api/hash.rst:108 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr ":c:func:`PyHash_GetFuncDef` 所使用的雜湊函式定義。" -#: ../../c-api/hash.rst:56 +#: ../../c-api/hash.rst:112 msgid "Hash function." msgstr "雜湊函式。" -#: ../../c-api/hash.rst:60 +#: ../../c-api/hash.rst:116 msgid "Hash function name (UTF-8 encoded string)." msgstr "雜湊函式名稱(UTF-8 編碼字串)。" -#: ../../c-api/hash.rst:64 +#: ../../c-api/hash.rst:118 +msgid "This corresponds to the :data:`sys.hash_info.algorithm` constant." +msgstr "" + +#: ../../c-api/hash.rst:122 msgid "Internal size of the hash value in bits." msgstr "雜湊值的內部大小(以位元為單位)。" -#: ../../c-api/hash.rst:68 +#: ../../c-api/hash.rst:124 +msgid "This corresponds to the :data:`sys.hash_info.hash_bits` constant." +msgstr "" + +#: ../../c-api/hash.rst:128 msgid "Size of seed input in bits." msgstr "Seed 輸入的大小(以位元為單位)。" -#: ../../c-api/hash.rst:75 +#: ../../c-api/hash.rst:130 +msgid "This corresponds to the :data:`sys.hash_info.seed_bits` constant." +msgstr "" + +#: ../../c-api/hash.rst:137 msgid "Get the hash function definition." msgstr "取得雜湊函式定義。" -#: ../../c-api/hash.rst:78 +#: ../../c-api/hash.rst:140 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." msgstr "" ":pep:`456`\\ 「安全且可交替使用的雜湊演算法 (Secure and interchangeable hash " "algorithm)」。" -#: ../../c-api/hash.rst:85 +#: ../../c-api/hash.rst:147 msgid "" "Hash a pointer value: process the pointer value as an integer (cast it to " "``uintptr_t`` internally). The pointer is not dereferenced." @@ -96,11 +171,11 @@ msgstr "" "雜湊指標值:將指標值作為整數處理(在內部轉型為 ``uintptr_t``)。指標不會被取" "值 (dereference)。" -#: ../../c-api/hash.rst:88 +#: ../../c-api/hash.rst:150 msgid "The function cannot fail: it cannot return ``-1``." msgstr "此函式不會失敗:它不會回傳 ``-1``。" -#: ../../c-api/hash.rst:95 +#: ../../c-api/hash.rst:157 msgid "" "Compute and return the hash value of a buffer of *len* bytes starting at " "address *ptr*. The hash is guaranteed to match that of :class:`bytes`, :" @@ -108,21 +183,21 @@ msgid "" "`buffer protocol `." msgstr "" -#: ../../c-api/hash.rst:100 +#: ../../c-api/hash.rst:162 msgid "" "Use this function to implement hashing for immutable objects whose :c:member:" "`~PyTypeObject.tp_richcompare` function compares to another object's buffer." msgstr "" -#: ../../c-api/hash.rst:104 +#: ../../c-api/hash.rst:166 msgid "*len* must be greater than or equal to ``0``." msgstr "*len* 必須大於或等於 ``0``。" -#: ../../c-api/hash.rst:106 +#: ../../c-api/hash.rst:168 msgid "This function always succeeds." msgstr "此函式總是會成功執行。" -#: ../../c-api/hash.rst:113 +#: ../../c-api/hash.rst:175 msgid "" "Generic hashing function that is meant to be put into a type object's " "``tp_hash`` slot. Its result only depends on the object's identity." @@ -130,6 +205,6 @@ msgstr "" "泛用雜湊函式,旨在放入型別物件的 ``tp_hash`` 插槽中。其結果僅取決於物件的識別" "性。" -#: ../../c-api/hash.rst:118 +#: ../../c-api/hash.rst:180 msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." msgstr "在 CPython 中,它等價於 :c:func:`Py_HashPointer`。" diff --git a/c-api/intro.po b/c-api/intro.po index 3e9ccded14..cae67c2de9 100644 --- a/c-api/intro.po +++ b/c-api/intro.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: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgid "" "API. The first reason is to write *extension modules* for specific purposes; " "these are C modules that extend the Python interpreter. This is probably " "the most common use. The second reason is to use Python as a component in a " -"larger application; this technique is generally referred to " -"as :dfn:`embedding` Python in an application." +"larger application; this technique is generally referred to as :dfn:" +"`embedding` Python in an application." msgstr "" "對於 Python 的應用程式開發介面使得 C 和 C++ 開發者能夠在各種層級存取 Python " "直譯器。該 API 同樣可用於 C++,但為簡潔起見,通常將其稱為 Python/C API。使用 " @@ -119,8 +119,8 @@ msgstr "" #: ../../c-api/intro.rst:64 msgid "" "This implies inclusion of the following standard headers: ````, " -"````, ````, ````, ```` and " -"```` (if available)." +"````, ````, ````, ```` and ```` (if available)." msgstr "" "這意味著會引入以下標準標頭:````、````、````、" "````、```` 和 ````\\ (如果可用)。" @@ -168,17 +168,17 @@ msgstr "" #: ../../c-api/intro.rst:89 msgid "" "The header files are typically installed with Python. On Unix, these are " -"located in the directories :file:`{prefix}/include/pythonversion/` " -"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" -"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " -"corresponding parameters to Python's :program:`configure` script and " -"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " -"are installed in :file:`{prefix}/include`, where ``prefix`` is the " -"installation directory specified to the installer." +"located in the directories :file:`{prefix}/include/pythonversion/` and :file:" +"`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` " +"and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding " +"parameters to Python's :program:`configure` script and *version* is ``'%d." +"%d' % sys.version_info[:2]``. On Windows, the headers are installed in :" +"file:`{prefix}/include`, where ``prefix`` is the installation directory " +"specified to the installer." msgstr "" "標頭檔通常隨 Python 一起安裝。在 Unix 上它們位於目錄 :file:`{prefix}/include/" -"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其" -"中 :option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " +"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其中 :" +"option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " "Python 的 :program:`configure` 腳本的相應參數定義,*version* 是 ``'%d.%d' % " "sys.version_info[:2]``。在 Windows 上,標頭安裝在 :file:`{prefix}/include` " "中,其中 ``prefix`` 是指定給安裝程式 (installer) 用的安裝目錄。" @@ -188,14 +188,14 @@ msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " "on the search path and then use ``#include ``; this will " -"break on multi-platform builds since the platform independent headers " -"under :option:`prefix <--prefix>` include the platform specific headers " -"from :option:`exec_prefix <--exec-prefix>`." +"break on multi-platform builds since the platform independent headers under :" +"option:`prefix <--prefix>` include the platform specific headers from :" +"option:`exec_prefix <--exec-prefix>`." msgstr "" "要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜尋路徑 (search path) " -"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立" -"於平台的標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" +"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include ``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立於平台的" +"標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" #: ../../c-api/intro.rst:105 msgid "" @@ -213,13 +213,12 @@ msgstr "有用的巨集" #: ../../c-api/intro.rst:113 msgid "" "Several useful macros are defined in the Python header files. Many are " -"defined closer to where they are useful (for " -"example, :c:macro:`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a " -"more general utility are defined here. This is not necessarily a complete " -"listing." +"defined closer to where they are useful (for example, :c:macro:" +"`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a more general " +"utility are defined here. This is not necessarily a complete listing." msgstr "" -"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例" -"如 :c:macro:`Py_RETURN_NONE`、:c:macro:`PyMODINIT_FUNC`),其他是更通用的工具程式。" +"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例如 :c:" +"macro:`Py_RETURN_NONE`、:c:macro:`PyMODINIT_FUNC`),其他是更通用的工具程式。" "以下並不一定是完整的列表。" #: ../../c-api/intro.rst:122 @@ -254,13 +253,12 @@ msgstr "" #: ../../c-api/intro.rst:139 msgid "" -"If Python is :ref:`built in debug mode ` (if " -"the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` " -"macro does nothing." +"If Python is :ref:`built in debug mode ` (if the :c:macro:" +"`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " +"nothing." msgstr "" -"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如" -"果 :c:macro:`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼" -"都不會做。" +"如果 Python 是\\ :ref:`在除錯模式下建置 `\\ (如果 :c:macro:" +"`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼都不會做。" #: ../../c-api/intro.rst:142 msgid "It must be specified before the function return type. Usage::" @@ -284,8 +282,8 @@ msgid "" "symbol name." msgstr "將其用於已棄用的聲明。巨集必須放在符號名稱之前。" -#: ../../c-api/intro.rst:158 ../../c-api/intro.rst:244 -#: ../../c-api/intro.rst:262 +#: ../../c-api/intro.rst:158 ../../c-api/intro.rst:267 +#: ../../c-api/intro.rst:285 msgid "Example::" msgstr "範例: ::" @@ -320,8 +318,8 @@ msgstr "回傳 ``x`` 和 ``y`` 之間的最小值。" #: ../../c-api/intro.rst:190 msgid "" "Disable inlining on a function. For example, it reduces the C stack " -"consumption: useful on LTO+PGO builds which heavily inline code " -"(see :issue:`33720`)." +"consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" +"`33720`)." msgstr "" "禁用函式的嵌入。例如,它減少了 C 堆疊的消耗:對大量嵌入程式碼的 LTO+PGO 建置" "很有用(請參閱 :issue:`33720`)。" @@ -366,8 +364,8 @@ msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明" -"為 :c:macro:`_Py_NO_RETURN` 的函式之呼叫後使用。" +"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明為 :c:macro:" +"`_Py_NO_RETURN` 的函式之呼叫後使用。" #: ../../c-api/intro.rst:221 msgid "" @@ -391,13 +389,43 @@ msgstr "" #: ../../c-api/intro.rst:238 msgid "" -"Creates a variable with name ``name`` that can be used in docstrings. If " +"Asserts a compile-time condition *cond*, as a statement. The build will fail " +"if the condition is false or cannot be evaluated at compile time." +msgstr "" + +#: ../../c-api/intro.rst:241 ../../c-api/intro.rst:252 +#: ../../c-api/intro.rst:297 +#, fuzzy +msgid "For example::" +msgstr "範例: ::" + +#: ../../c-api/intro.rst:243 +msgid "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));" +msgstr "" + +#: ../../c-api/intro.rst:249 +msgid "" +"Asserts a compile-time condition *cond*, as an expression that evaluates to " +"``0``. The build will fail if the condition is false or cannot be evaluated " +"at compile time." +msgstr "" + +#: ../../c-api/intro.rst:254 +msgid "" +"#define foo_to_char(foo) \\\n" +" ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))" +msgstr "" + +#: ../../c-api/intro.rst:261 +#, fuzzy +msgid "" +"Creates a variable with name *name* that can be used in docstrings. If " "Python is built without docstrings, the value will be empty." msgstr "" "建立一個名為 ``name`` 的變數,可以在文件字串中使用。如果 Python 是在沒有文件" "字串的情況下建置,則該值將為空。" -#: ../../c-api/intro.rst:241 +#: ../../c-api/intro.rst:264 msgid "" "Use :c:macro:`PyDoc_STRVAR` for docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -405,7 +433,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STRVAR` 作為文件字串可以支援在沒有" "文件字串的情況下建置 Python。" -#: ../../c-api/intro.rst:246 +#: ../../c-api/intro.rst:269 msgid "" "PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" "\n" @@ -416,13 +444,13 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:256 +#: ../../c-api/intro.rst:279 msgid "" "Creates a docstring for the given input string or an empty string if " "docstrings are disabled." msgstr "為給定的輸入字串建立一個文件字串,如果文件字串被禁用則建立空字串。" -#: ../../c-api/intro.rst:259 +#: ../../c-api/intro.rst:282 msgid "" "Use :c:macro:`PyDoc_STR` in specifying docstrings to support building Python " "without docstrings, as specified in :pep:`7`." @@ -430,7 +458,7 @@ msgstr "" "如 :pep:`7` 中所指明,使用 :c:macro:`PyDoc_STR` 指定文件字串以支援在沒有文件" "字串下建置 Python。" -#: ../../c-api/intro.rst:264 +#: ../../c-api/intro.rst:287 msgid "" "static PyMethodDef pysqlite_row_methods[] = {\n" " {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" @@ -439,11 +467,23 @@ msgid "" "};" msgstr "" -#: ../../c-api/intro.rst:274 +#: ../../c-api/intro.rst:295 +msgid "Declares a static character array variable with the given name *name*." +msgstr "" + +#: ../../c-api/intro.rst:299 +msgid "" +"PyDoc_VAR(python_doc) = PyDoc_STR(\"A genus of constricting snakes in the " +"Pythonidae family native \"\n" +" \"to the tropics and subtropics of the " +"Eastern Hemisphere.\");" +msgstr "" + +#: ../../c-api/intro.rst:306 msgid "Objects, Types and Reference Counts" msgstr "物件、型別和參照計數" -#: ../../c-api/intro.rst:278 +#: ../../c-api/intro.rst:310 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -451,9 +491,9 @@ msgid "" "are treated the same way by the Python language in most situations (e.g., " "assignments, scope rules, and argument passing), it is only fitting that " "they should be represented by a single C type. Almost all Python objects " -"live on the heap: you never declare an automatic or static variable of " -"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " -"can be declared. The sole exception are the type objects; since these must " +"live on the heap: you never declare an automatic or static variable of type :" +"c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can " +"be declared. The sole exception are the type objects; since these must " "never be deallocated, they are typically static :c:type:`PyTypeObject` " "objects." msgstr "" @@ -466,28 +506,27 @@ msgstr "" "別物件;由於它們絕不能被釋放,因此它們通常是靜態 :c:type:`PyTypeObject` 物" "件。" -#: ../../c-api/intro.rst:289 +#: ../../c-api/intro.rst:321 msgid "" -"All Python objects (even Python integers) have a :dfn:`type` and " -"a :dfn:`reference count`. An object's type determines what kind of object " -"it is (e.g., an integer, a list, or a user-defined function; there are many " -"more as explained in :ref:`types`). For each of the well-known types there " -"is a macro to check whether an object is of that type; for instance, " +"All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" +"`reference count`. An object's type determines what kind of object it is (e." +"g., an integer, a list, or a user-defined function; there are many more as " +"explained in :ref:`types`). For each of the well-known types there is a " +"macro to check whether an object is of that type; for instance, " "``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " "a Python list." msgstr "" "所有 Python 物件(甚至是 Python 整數)都有一個型別 (:dfn:`type`) 和一個參照計" "數 (:dfn:`reference count`)。一個物件的型別決定了它是什麼種類的物件(例如一個" -"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見" -"\\ :ref:`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於" -"該型別;例如,若(且唯若)*a* 指向的物件是 Python list 時," -"``PyList_Check(a)`` 為真。" +"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見\\ :ref:" +"`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於該型別;" +"例如,若(且唯若)*a* 指向的物件是 Python list 時,``PyList_Check(a)`` 為真。" -#: ../../c-api/intro.rst:300 +#: ../../c-api/intro.rst:332 msgid "Reference Counts" msgstr "參照計數" -#: ../../c-api/intro.rst:302 +#: ../../c-api/intro.rst:334 msgid "" "The reference count is important because today's computers have a finite " "(and often severely limited) memory size; it counts how many different " @@ -510,23 +549,23 @@ msgstr "" "則可以依次為那些其他物件解除配置,依此類推。(此處相互參照物件的存在是個明顯" "的問題;目前,解決方案是「就不要那樣做」。)" -#: ../../c-api/intro.rst:319 +#: ../../c-api/intro.rst:351 msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " "increment its reference count by one), and :c:func:`Py_DECREF` to release " -"that reference (i.e. decrement the reference count by one). " -"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " -"one, since it must check whether the reference count becomes zero and then " -"cause the object's deallocator to be called. The deallocator is a function " -"pointer contained in the object's type structure. The type-specific " -"deallocator takes care of releasing references for other objects contained " -"in the object if this is a compound object type, such as a list, as well as " -"performing any additional finalization that's needed. There's no chance " -"that the reference count can overflow; at least as many bits are used to " -"hold the reference count as there are distinct memory locations in virtual " -"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " -"reference count increment is a simple operation." +"that reference (i.e. decrement the reference count by one). The :c:func:" +"`Py_DECREF` macro is considerably more complex than the incref one, since it " +"must check whether the reference count becomes zero and then cause the " +"object's deallocator to be called. The deallocator is a function pointer " +"contained in the object's type structure. The type-specific deallocator " +"takes care of releasing references for other objects contained in the object " +"if this is a compound object type, such as a list, as well as performing any " +"additional finalization that's needed. There's no chance that the reference " +"count can overflow; at least as many bits are used to hold the reference " +"count as there are distinct memory locations in virtual memory (assuming " +"``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count " +"increment is a simple operation." msgstr "" "參照計數總是被明確地操作。正常的方法是使用巨集 :c:func:`Py_INCREF` 來取得對於" "物件的參照(即參照計數加一),並使用巨集 :c:func:`Py_DECREF` 來釋放參照(即將" @@ -538,7 +577,7 @@ msgstr "" "元會被使用(假設 ``sizeof(Py_ssize_t) >= sizeof(void*)``)。因此參照計數增加" "是一個簡單的操作。" -#: ../../c-api/intro.rst:335 +#: ../../c-api/intro.rst:367 msgid "" "It is not necessary to hold a :term:`strong reference` (i.e. increment the " "reference count) for every local variable that contains a pointer to an " @@ -564,15 +603,15 @@ msgstr "" "種情況的一個重要情況是在從 Python 呼叫的擴充模組中作為引數傳遞給 C 函式的物" "件;呼叫機制保證在呼叫期間保持對每個參數的參照。" -#: ../../c-api/intro.rst:351 +#: ../../c-api/intro.rst:383 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without taking a new reference. Some other operation might " "conceivably remove the object from the list, releasing that reference, and " "possibly deallocating it. The real danger is that innocent-looking " "operations may invoke arbitrary Python code which could do this; there is a " -"code path which allows control to flow back to the user from " -"a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." +"code path which allows control to flow back to the user from a :c:func:" +"`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" "然而,一個常見的陷阱是從一個 list 中提取一個物件並保留它一段時間而不取得其參" "照。某些其他操作可能會從列表中刪除該物件,減少其參照計數並可能取消分配它。真" @@ -580,7 +619,7 @@ msgstr "" "程式碼路徑允許控制權從 :c:func:`Py_DECREF` 回歸使用者,因此幾乎任何操作都有潛" "在危險。" -#: ../../c-api/intro.rst:359 +#: ../../c-api/intro.rst:391 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -595,11 +634,11 @@ msgstr "" "計數)。這讓呼叫者有責任在處理完結果後呼叫 :c:func:`Py_DECREF`;這就成為第二" "本質。" -#: ../../c-api/intro.rst:370 +#: ../../c-api/intro.rst:402 msgid "Reference Count Details" msgstr "參照計數詳細資訊" -#: ../../c-api/intro.rst:372 +#: ../../c-api/intro.rst:404 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -607,24 +646,24 @@ msgid "" "shared). \"Owning a reference\" means being responsible for calling " "Py_DECREF on it when the reference is no longer needed. Ownership can also " "be transferred, meaning that the code that receives ownership of the " -"reference then becomes responsible for eventually releasing it by " -"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " -"needed---or passing on this responsibility (usually to its caller). When a " -"function passes ownership of a reference on to its caller, the caller is " -"said to receive a *new* reference. When no ownership is transferred, the " -"caller is said to *borrow* the reference. Nothing needs to be done for " -"a :term:`borrowed reference`." +"reference then becomes responsible for eventually releasing it by calling :c:" +"func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or " +"passing on this responsibility (usually to its caller). When a function " +"passes ownership of a reference on to its caller, the caller is said to " +"receive a *new* reference. When no ownership is transferred, the caller is " +"said to *borrow* the reference. Nothing needs to be done for a :term:" +"`borrowed reference`." msgstr "" "Python/C API 中函式的參照計數行為最好用\\ *參照的所有權*\\ 來解釋。所有權附屬" "於參照而非物件(物件並非被擁有,它們總是共享的)。「擁有參照」意味著當不再需" "要該參照時,負責在其上呼叫 Py_DECREF。所有權也可以轉移,這意味著接收參照所有" -"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` " -"或 :c:func:`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼" -"叫者)。當一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ " -"*新*\\ 參照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是" -"\\ :term:`借用參照 `\\ 就不需要做任何事情。" +"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` 或 :c:func:" +"`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼叫者)。當" +"一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ *新*\\ 參" +"照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是\\ :term:`借用參" +"照 `\\ 就不需要做任何事情。" -#: ../../c-api/intro.rst:385 +#: ../../c-api/intro.rst:417 msgid "" "Conversely, when a calling function passes in a reference to an object, " "there are two possibilities: the function *steals* a reference to the " @@ -636,24 +675,24 @@ msgstr "" "物件的參照,或者沒有。 *竊取參照*\\ 意味著當你將參照傳遞給函式時,該函式假定" "它現在擁有該參照,並且你不再對它負責。" -#: ../../c-api/intro.rst:395 +#: ../../c-api/intro.rst:427 msgid "" -"Few functions steal references; the two notable exceptions " -"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " -"reference to the item (but not to the tuple or list into which the item is " -"put!). These functions were designed to steal a reference because of a " -"common idiom for populating a tuple or list with newly created objects; for " -"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " -"this (forgetting about error handling for the moment; a better way to code " -"this is shown below)::" +"Few functions steal references; the two notable exceptions are :c:func:" +"`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " +"the item (but not to the tuple or list into which the item is put!). These " +"functions were designed to steal a reference because of a common idiom for " +"populating a tuple or list with newly created objects; for example, the code " +"to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting " +"about error handling for the moment; a better way to code this is shown " +"below)::" msgstr "" -"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` " -"和 :c:func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 " -"tuple 或 list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 " -"list 的習慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的" -"程式碼可以如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" +"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` 和 :c:" +"func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 tuple 或 " +"list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 list 的習" +"慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的程式碼可以" +"如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" -#: ../../c-api/intro.rst:403 +#: ../../c-api/intro.rst:435 msgid "" "PyObject *t;\n" "\n" @@ -669,52 +708,51 @@ msgstr "" "PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" "PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" -#: ../../c-api/intro.rst:410 +#: ../../c-api/intro.rst:442 msgid "" "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " "stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " "although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " "another reference before calling the reference-stealing function." msgstr "" -"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即" -"被 :c:func:`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將" -"被竊取,請在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" +"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即被 :c:func:" +"`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" +"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" -#: ../../c-api/intro.rst:415 +#: ../../c-api/intro.rst:447 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " -"do this since tuples are an immutable data type. You should only " -"use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." +"do this since tuples are an immutable data type. You should only use :c:" +"func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方" -"法; :c:func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做," -"因為 tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple " -"使用 :c:func:`PyTuple_SetItem`。" +"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方法; :c:" +"func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做,因為 " +"tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple 使" +"用 :c:func:`PyTuple_SetItem`。" -#: ../../c-api/intro.rst:420 +#: ../../c-api/intro.rst:452 msgid "" -"Equivalent code for populating a list can be written " -"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." +"Equivalent code for populating a list can be written using :c:func:" +"`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" "可以使用 :c:func:`PyList_New` 和 :c:func:`PyList_SetItem` 編寫用於填充列表的" "等效程式碼。" -#: ../../c-api/intro.rst:423 +#: ../../c-api/intro.rst:455 msgid "" "However, in practice, you will rarely use these ways of creating and " -"populating a tuple or list. There's a generic " -"function, :c:func:`Py_BuildValue`, that can create most common objects from " -"C values, directed by a :dfn:`format string`. For example, the above two " -"blocks of code could be replaced by the following (which also takes care of " -"the error checking)::" +"populating a tuple or list. There's a generic function, :c:func:" +"`Py_BuildValue`, that can create most common objects from C values, directed " +"by a :dfn:`format string`. For example, the above two blocks of code could " +"be replaced by the following (which also takes care of the error checking)::" msgstr "" "但是在實際操作中你很少會使用這些方法來建立和增加 tuple 和 list。有一個通用函" "式 :c:func:`Py_BuildValue` 可以從 C 值建立最常見的物件,由 :dfn:`format " "string` 引導。例如上面的兩個程式碼可以用以下程式碼替換(它還負責了錯誤檢" "查): ::" -#: ../../c-api/intro.rst:429 +#: ../../c-api/intro.rst:461 msgid "" "PyObject *tuple, *list;\n" "\n" @@ -726,7 +764,7 @@ msgstr "" "tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" "list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" -#: ../../c-api/intro.rst:434 +#: ../../c-api/intro.rst:466 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -741,7 +779,7 @@ msgstr "" "穩健,因為你不取得新的一個參照就可以放棄參照(「讓它被竊取」)。例如,此函式" "將 list(實際上是任何可變序列)的所有項目設定於給定項目:" -#: ../../c-api/intro.rst:441 +#: ../../c-api/intro.rst:473 msgid "" "int\n" "set_all(PyObject *target, PyObject *item)\n" @@ -785,7 +823,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/intro.rst:464 +#: ../../c-api/intro.rst:496 msgid "" "The situation is slightly different for function return values. While " "passing a reference to most functions does not change your ownership " @@ -803,7 +841,7 @@ msgstr "" "照的通用函式,如 :c:func:`PyObject_GetItem` 和 :c:func:`PySequence_GetItem`," "總是回傳一個新的參照(呼叫者成為參照的所有者)。" -#: ../../c-api/intro.rst:473 +#: ../../c-api/intro.rst:505 msgid "" "It is important to realize that whether you own a reference returned by a " "function depends on which function you call only --- *the plumage* (the type " @@ -819,16 +857,16 @@ msgstr "" "如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中取得相同的項目(且恰好" "使用完全相同的引數),你確實會擁有對回傳物件的參照。" -#: ../../c-api/intro.rst:485 +#: ../../c-api/intro.rst:517 msgid "" "Here is an example of how you could write a function that computes the sum " "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使" -"用 :c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" +"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使用 :" +"c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" -#: ../../c-api/intro.rst:489 +#: ../../c-api/intro.rst:521 msgid "" "long\n" "sum_list(PyObject *list)\n" @@ -853,7 +891,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:515 +#: ../../c-api/intro.rst:547 msgid "" "long\n" "sum_sequence(PyObject *sequence)\n" @@ -884,26 +922,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:549 +#: ../../c-api/intro.rst:581 msgid "Types" msgstr "型別" -#: ../../c-api/intro.rst:551 +#: ../../c-api/intro.rst:583 msgid "" "There are few other data types that play a significant role in the Python/C " -"API; most are simple C types such " -"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " -"few structure types are used to describe static tables used to list the " -"functions exported by a module or the data attributes of a new object type, " -"and another is used to describe the value of a complex number. These will " -"be discussed together with the functions that use them." +"API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" +"`double` and :c:expr:`char*`. A few structure types are used to describe " +"static tables used to list the functions exported by a module or the data " +"attributes of a new object type, and another is used to describe the value " +"of a complex number. These will be discussed together with the functions " +"that use them." msgstr "" "有少數幾個其他的資料型別在 Python/C API 中發揮重要作用;大多數是簡單的 C 型" "別,例如 :c:expr:`int`、:c:expr:`long`、:c:expr:`double` 和 :c:expr:`char*`。" "一些結構型別被用於描述用於列出模組所匯出的函式或新物件型別的資料屬性的靜態" "表,其他則用於描述複數的值。這些將與使用它們的函式一起討論。" -#: ../../c-api/intro.rst:561 +#: ../../c-api/intro.rst:593 msgid "" "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " "C99 doesn't define such a thing directly (size_t is an unsigned integral " @@ -911,14 +949,14 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" "一個帶符號的整數型別,使得 ``sizeof(Py_ssize_t) == sizeof(size_t)``。 C99 沒" -"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參" -"閱 :pep:`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" +"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參閱 :pep:" +"`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" -#: ../../c-api/intro.rst:570 +#: ../../c-api/intro.rst:602 msgid "Exceptions" msgstr "例外" -#: ../../c-api/intro.rst:572 +#: ../../c-api/intro.rst:604 msgid "" "The Python programmer only needs to deal with exceptions if specific error " "handling is required; unhandled exceptions are automatically propagated to " @@ -930,7 +968,7 @@ msgstr "" "給呼叫者,然後傳遞給呼叫者的呼叫者,依此類推,直到它們到達頂層直譯器,在那裡" "它們透過堆疊回溯 (stack trace) 回報給使用者。" -#: ../../c-api/intro.rst:580 +#: ../../c-api/intro.rst:612 msgid "" "For C programmers, however, error checking always has to be explicit. All " "functions in the Python/C API can raise exceptions, unless an explicit claim " @@ -952,36 +990,36 @@ msgstr "" "確的錯誤指示器或者有不明確的回傳值,而需要使用 :c:func:`PyErr_Occurred` 明確" "測試錯誤。這些例外都會被明確地記錄於文件。" -#: ../../c-api/intro.rst:595 +#: ../../c-api/intro.rst:627 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " -"of two states: an exception has occurred, or not. The " -"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " -"a borrowed reference to the exception type object when an exception has " -"occurred, and ``NULL`` otherwise. There are a number of functions to set " -"the exception state: :c:func:`PyErr_SetString` is the most common (though " -"not the most general) function to set the exception state, " -"and :c:func:`PyErr_Clear` clears the exception state." +"of two states: an exception has occurred, or not. The function :c:func:" +"`PyErr_Occurred` can be used to check for this: it returns a borrowed " +"reference to the exception type object when an exception has occurred, and " +"``NULL`` otherwise. There are a number of functions to set the exception " +"state: :c:func:`PyErr_SetString` is the most common (though not the most " +"general) function to set the exception state, and :c:func:`PyErr_Clear` " +"clears the exception state." msgstr "" "例外的狀態會在個別執行緒的儲存空間 (per-thread storage) 中維護(這相當於在非" "執行緒應用程式中使用全域儲存空間)。執行緒可以處於兩種狀態之一:發生例外或未" "發生例外。函式 :c:func:`PyErr_Occurred` 可用於檢查這一點:當例外發生時,它回" -"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很" -"多::c:func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函" -"式,而 :c:func:`PyErr_Clear` 是用來清除例外狀態。" +"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很多::c:" +"func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函式,而 :" +"c:func:`PyErr_Clear` 是用來清除例外狀態。" -#: ../../c-api/intro.rst:605 +#: ../../c-api/intro.rst:637 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " -"traceback. These have the same meanings as the Python result of " -"``sys.exc_info()``; however, they are not the same: the Python objects " -"represent the last exception being handled by a " -"Python :keyword:`try` ... :keyword:`except` statement, while the C level " -"exception state only exists while an exception is being passed on between C " -"functions until it reaches the Python bytecode interpreter's main loop, " -"which takes care of transferring it to ``sys.exc_info()`` and friends." +"traceback. These have the same meanings as the Python result of ``sys." +"exc_info()``; however, they are not the same: the Python objects represent " +"the last exception being handled by a Python :keyword:`try` ... :keyword:" +"`except` statement, while the C level exception state only exists while an " +"exception is being passed on between C functions until it reaches the Python " +"bytecode interpreter's main loop, which takes care of transferring it to " +"``sys.exc_info()`` and friends." msgstr "" "完整的例外狀態由三個(都可以為 ``NULL`` 的)物件組成:例外型別、對應的例外值" "和回溯。這些與 ``sys.exc_info()`` 的 Python 結果具有相同的含義;但是它們並不" @@ -990,18 +1028,18 @@ msgstr "" "達 Python 位元組碼直譯器的主迴圈,該迴圈負責將它傳遞給 ``sys.exc_info()`` 和" "其系列函式。" -#: ../../c-api/intro.rst:617 +#: ../../c-api/intro.rst:649 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " -"the exception state from Python code is to call the " -"function :func:`sys.exc_info`, which returns the per-thread exception state " -"for Python code. Also, the semantics of both ways to access the exception " -"state have changed so that a function which catches an exception will save " -"and restore its thread's exception state so as to preserve the exception " -"state of its caller. This prevents common bugs in exception handling code " -"caused by an innocent-looking function overwriting the exception being " -"handled; it also reduces the often unwanted lifetime extension for objects " -"that are referenced by the stack frames in the traceback." +"the exception state from Python code is to call the function :func:`sys." +"exc_info`, which returns the per-thread exception state for Python code. " +"Also, the semantics of both ways to access the exception state have changed " +"so that a function which catches an exception will save and restore its " +"thread's exception state so as to preserve the exception state of its " +"caller. This prevents common bugs in exception handling code caused by an " +"innocent-looking function overwriting the exception being handled; it also " +"reduces the often unwanted lifetime extension for objects that are " +"referenced by the stack frames in the traceback." msgstr "" "請注意,從 Python 1.5 開始,從 Python 程式碼存取例外狀態的首選且支援執行緒安" "全的方法是呼叫 :func:`sys.exc_info` 函式,它回傳 Python 程式碼的個別執行緒例" @@ -1010,7 +1048,7 @@ msgstr "" "式碼中的常見錯誤,這些錯誤是由看似無辜的函式覆蓋了正在處理的例外而引起的;它" "還替回溯中被堆疊框 (stack frame) 參照的物件減少了通常不需要的生命週期延長。" -#: ../../c-api/intro.rst:628 +#: ../../c-api/intro.rst:660 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -1025,7 +1063,7 @@ msgstr "" "並回傳一個錯誤指示符,但它\\ *不應該*\\ 設定另一個例外 --- 這將覆蓋剛剛引發的" "例外,並丟失關於錯誤確切原因的重要資訊。" -#: ../../c-api/intro.rst:637 +#: ../../c-api/intro.rst:669 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`!sum_sequence` example above. It so happens that this example " @@ -1037,7 +1075,7 @@ msgstr "" "巧這個例子在檢測到錯誤時不需要清理任何擁有的參照。以下範例函式展示了一些錯誤" "清理。首先,為了提醒你為什麼喜歡 Python,我們展示了等效的 Python 程式碼: ::" -#: ../../c-api/intro.rst:643 +#: ../../c-api/intro.rst:675 msgid "" "def incr_item(dict, key):\n" " try:\n" @@ -1053,11 +1091,11 @@ msgstr "" " item = 0\n" " dict[key] = item + 1" -#: ../../c-api/intro.rst:652 +#: ../../c-api/intro.rst:684 msgid "Here is the corresponding C code, in all its glory::" msgstr "這是相應的 C 程式碼:" -#: ../../c-api/intro.rst:654 +#: ../../c-api/intro.rst:686 msgid "" "int\n" "incr_item(PyObject *dict, PyObject *key)\n" @@ -1103,31 +1141,30 @@ msgid "" "}" msgstr "" -#: ../../c-api/intro.rst:704 +#: ../../c-api/intro.rst:736 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " -"illustrates the use of :c:func:`PyErr_ExceptionMatches` " -"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " -"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " -"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " -"confronted with a ``NULL`` reference). It is important that the variables " -"used to hold owned references are initialized to ``NULL`` for this to work; " -"likewise, the proposed return value is initialized to ``-1`` (failure) and " -"only set to success after the final call made is successful." -msgstr "" -"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了" -"以 :c:func:`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例" -"外,以及以 :c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意" -"名稱中的 ``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要" -"的是,用於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣" -"地,回傳值被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成" -"功。" - -#: ../../c-api/intro.rst:718 +"illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" +"`PyErr_Clear` to handle specific exceptions, and the use of :c:func:" +"`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the " +"``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a " +"``NULL`` reference). It is important that the variables used to hold owned " +"references are initialized to ``NULL`` for this to work; likewise, the " +"proposed return value is initialized to ``-1`` (failure) and only set to " +"success after the final call made is successful." +msgstr "" +"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了以 :c:func:" +"`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例外,以及以 :" +"c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意名稱中的 " +"``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要的是,用" +"於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣地,回傳值" +"被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成功。" + +#: ../../c-api/intro.rst:750 msgid "Embedding Python" msgstr "嵌入式Python" -#: ../../c-api/intro.rst:720 +#: ../../c-api/intro.rst:752 msgid "" "The one important task that only embedders (as opposed to extension writers) " "of the Python interpreter have to worry about is the initialization, and " @@ -1137,7 +1174,7 @@ msgstr "" "只有 Python 直譯器的嵌入者(而不是擴充編寫者)需要擔心的一項重要任務是 " "Python 直譯器的初始化與完成階段。直譯器的大部分功能只能在直譯器初始化後使用。" -#: ../../c-api/intro.rst:733 +#: ../../c-api/intro.rst:765 msgid "" "The basic initialization function is :c:func:`Py_Initialize`. This " "initializes the table of loaded modules, and creates the fundamental " @@ -1148,20 +1185,19 @@ msgstr "" "立基礎模組 :mod:`builtins`、:mod:`__main__` 和 :mod:`sys`。它還會初始化模組搜" "索路徑 (``sys.path``)。" -#: ../../c-api/intro.rst:738 +#: ../../c-api/intro.rst:770 msgid "" -":c:func:`Py_Initialize` does not set the \"script argument list\" " -"(``sys.argv``). If this variable is needed by Python code that will be " -"executed later, setting :c:member:`PyConfig.argv` " -"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " -"Initialization Configuration `." +":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." +"argv``). If this variable is needed by Python code that will be executed " +"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " +"must be set: see :ref:`Python Initialization Configuration `." msgstr "" -":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 " -"(``sys.argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設" -"定 :c:member:`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請" -"見 :ref:`Python 初始化配置 `。" +":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 (``sys." +"argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設定 :c:member:" +"`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請見 :ref:`Python 初始化" +"配置 `。" -#: ../../c-api/intro.rst:743 +#: ../../c-api/intro.rst:775 msgid "" "On most systems (in particular, on Unix and Windows, although the details " "are slightly different), :c:func:`Py_Initialize` calculates the module " @@ -1172,75 +1208,73 @@ msgid "" "to the parent directory where the executable named :file:`python` is found " "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不" -"同),:c:func:`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔" -"案的位置固定,並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組" -"搜尋路徑。或者更詳細地說,它會在 shell 命令搜尋路徑(環境變" -"數 :envvar:`PATH`)中找到名為 :file:`python` 的可執行檔案,並在其父目錄中查找" -"一個名為 :file:`lib/python{X.Y}` 的目錄的相對位置。" +"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不同),:c:func:" +"`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔案的位置固定," +"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜尋路徑。或者" +"更詳細地說,它會在 shell 命令搜尋路徑(環境變數 :envvar:`PATH`)中找到名為 :" +"file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" +"` 的目錄的相對位置。" -#: ../../c-api/intro.rst:752 +#: ../../c-api/intro.rst:784 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" "python{X.Y}`. (In fact, this particular path is also the \"fallback\" " -"location, used when no executable file named :file:`python` is found " -"along :envvar:`PATH`.) The user can override this behavior by setting the " +"location, used when no executable file named :file:`python` is found along :" +"envvar:`PATH`.) The user can override this behavior by setting the " "environment variable :envvar:`PYTHONHOME`, or insert additional directories " "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" "例如,如果在 :file:`/usr/local/bin/python` 中找到 Python 可執行檔案,它將假定" "函式庫位於 :file:`/usr/local/lib/python{X.Y}` 中。(事實上這個特定的路徑也是" "「後備 (fallback)」位置,當在 :envvar:`PATH` 中找不到名為 :file:`python` 的可" -"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行" -"為 :envvar:`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入" -"額外的目錄。" - -#: ../../c-api/intro.rst:766 -msgid "" -"The embedding application can steer the search by " -"setting :c:member:`PyConfig.program_name` *before* " -"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " -"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " -"the standard path. An application that requires total control has to " -"provide its own implementation " -"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " -"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" -"getpath.c`)." +"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行為 :envvar:" +"`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" +"錄。" + +#: ../../c-api/intro.rst:798 +msgid "" +"The embedding application can steer the search by setting :c:member:" +"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " +"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " +"is still inserted in front of the standard path. An application that " +"requires total control has to provide its own implementation of :c:func:" +"`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" +"func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" "嵌入的應用程式可以透過在呼叫 :c:func:`Py_InitializeFromConfig` *之前*\\ 設" "定 :c:member:`PyConfig.program_name` 來引導搜尋。請注意 :envvar:`PYTHONHOME` " "仍然覆蓋它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權" -"的應用程式必須實作自己" -"的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix` " -"和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:`Modules/getpath.c`)。" +"的應用程式必須實作自己的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:" +"func:`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :" +"file:`Modules/getpath.c`)。" -#: ../../c-api/intro.rst:777 +#: ../../c-api/intro.rst:809 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " -"application may want to start over (make another call " -"to :c:func:`Py_Initialize`) or the application is simply done with its use " -"of Python and wants to free memory allocated by Python. This can be " -"accomplished by calling :c:func:`Py_FinalizeEx`. The " -"function :c:func:`Py_IsInitialized` returns true if Python is currently in " -"the initialized state. More information about these functions is given in a " -"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " -"memory allocated by the Python interpreter, e.g. memory allocated by " -"extension modules currently cannot be released." +"application may want to start over (make another call to :c:func:" +"`Py_Initialize`) or the application is simply done with its use of Python " +"and wants to free memory allocated by Python. This can be accomplished by " +"calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` " +"returns true if Python is currently in the initialized state. More " +"information about these functions is given in a later chapter. Notice that :" +"c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python " +"interpreter, e.g. memory allocated by extension modules currently cannot be " +"released." msgstr "" "有時會希望能夠「取消初始化 (uninitialize)」Python。例如,應用程式可能想要重新" "開始(再次呼叫 :c:func:`Py_Initialize`)或者應用程式簡單地完成了對 Python 的" "使用並想要釋放 Python 分配的記憶體。這可以透過呼叫 :c:func:`Py_FinalizeEx` 來" "完成。如果 Python 目前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " -"true。有關這些功能的更多資訊將在後面的章節中給出。請注" -"意 :c:func:`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例" -"如目前無法釋放被擴充模組所分配的記憶體。" +"true。有關這些功能的更多資訊將在後面的章節中給出。請注意 :c:func:" +"`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" +"放被擴充模組所分配的記憶體。" -#: ../../c-api/intro.rst:791 +#: ../../c-api/intro.rst:823 msgid "Debugging Builds" msgstr "除錯建置" -#: ../../c-api/intro.rst:793 +#: ../../c-api/intro.rst:825 msgid "" "Python can be built with several macros to enable extra checks of the " "interpreter and extension modules. These checks tend to add a large amount " @@ -1249,36 +1283,36 @@ msgstr "" "Python 可以在建置時使用多個巨集來啟用對直譯器和擴充模組的額外檢查,這些檢查往" "往會在執行環境 (runtime) 增加大量開銷 (overhead),因此預設情況下不啟用它們。" -#: ../../c-api/intro.rst:797 +#: ../../c-api/intro.rst:829 msgid "" -"A full list of the various types of debugging builds is in the " -"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " -"Builds are available that support tracing of reference counts, debugging the " -"memory allocator, or low-level profiling of the main interpreter loop. Only " -"the most frequently used builds will be described in the remainder of this " +"A full list of the various types of debugging builds is in the file :file:" +"`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " +"available that support tracing of reference counts, debugging the memory " +"allocator, or low-level profiling of the main interpreter loop. Only the " +"most frequently used builds will be described in the remainder of this " "section." msgstr "" "Python 原始碼發佈版本中的 :file:`Misc/SpecialBuilds.txt` 檔案有一份包含多種除" "錯構置的完整列表,為支援追蹤參照計數、為記憶體分配器除錯或對主直譯器迴圈進行" "低階分析的建置。本節的其餘部分將僅描述最常用的建置。" -#: ../../c-api/intro.rst:805 +#: ../../c-api/intro.rst:837 msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " -"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " -"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " -"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " -"optimization is disabled." +"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:" +"`--with-pydebug` to the :file:`./configure` command. It is also implied by " +"the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:" +"macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is " +"disabled." msgstr "" "使用定義的 :c:macro:`!Py_DEBUG` 巨集編譯直譯器會生成 :ref:`Python 的除錯建置 " "`。 :c:macro:`!Py_DEBUG` 在 Unix 建置中要透過在 :file:`./" -"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定" -"的 :c:macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 " -"Unix 建置中啟用時,編譯器最佳化會被禁用。" +"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定的 :c:" +"macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 Unix 建" +"置中啟用時,編譯器最佳化會被禁用。" -#: ../../c-api/intro.rst:813 +#: ../../c-api/intro.rst:845 msgid "" "In addition to the reference count debugging described below, extra checks " "are performed, see :ref:`Python Debug Build `." @@ -1286,72 +1320,72 @@ msgstr "" "除了下面描述的參照計數除錯之外,還會執行額外的檢查,請參閱 :ref:`Python 除錯" "建置 `。" -#: ../../c-api/intro.rst:816 +#: ../../c-api/intro.rst:848 msgid "" -"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see " -"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " -"defined, a circular doubly linked list of active objects is maintained by " -"adding two extra fields to every :c:type:`PyObject`. Total allocations are " -"tracked as well. Upon exit, all existing references are printed. (In " -"interactive mode this happens after every statement run by the interpreter.)" +"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" +"`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " +"circular doubly linked list of active objects is maintained by adding two " +"extra fields to every :c:type:`PyObject`. Total allocations are tracked as " +"well. Upon exit, all existing references are printed. (In interactive mode " +"this happens after every statement run by the interpreter.)" msgstr "" "定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`設定 --with-" -"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每" -"個 :c:type:`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular " -"doubly linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模" -"式下,這發生在直譯器運行的每個陳述句之後。)" +"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每個 :c:type:" +"`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular doubly " +"linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," +"這發生在直譯器運行的每個陳述句之後。)" -#: ../../c-api/intro.rst:823 +#: ../../c-api/intro.rst:855 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/" -"SpecialBuilds.txt`。" +"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/SpecialBuilds." +"txt`。" -#: ../../c-api/intro.rst:830 +#: ../../c-api/intro.rst:862 msgid "Recommended third party tools" msgstr "" -#: ../../c-api/intro.rst:832 +#: ../../c-api/intro.rst:864 msgid "" "The following third party tools offer both simpler and more sophisticated " "approaches to creating C, C++ and Rust extensions for Python:" msgstr "" -#: ../../c-api/intro.rst:835 +#: ../../c-api/intro.rst:867 msgid "`Cython `_" msgstr "" -#: ../../c-api/intro.rst:836 +#: ../../c-api/intro.rst:868 msgid "`cffi `_" msgstr "" -#: ../../c-api/intro.rst:837 +#: ../../c-api/intro.rst:869 msgid "`HPy `_" msgstr "" -#: ../../c-api/intro.rst:838 +#: ../../c-api/intro.rst:870 msgid "`nanobind `_ (C++)" msgstr "" -#: ../../c-api/intro.rst:839 +#: ../../c-api/intro.rst:871 msgid "`Numba `_" msgstr "" -#: ../../c-api/intro.rst:840 +#: ../../c-api/intro.rst:872 msgid "`pybind11 `_ (C++)" msgstr "" -#: ../../c-api/intro.rst:841 +#: ../../c-api/intro.rst:873 msgid "`PyO3 `_ (Rust)" msgstr "" -#: ../../c-api/intro.rst:842 +#: ../../c-api/intro.rst:874 msgid "`SWIG `_" msgstr "" -#: ../../c-api/intro.rst:844 +#: ../../c-api/intro.rst:876 msgid "" "Using tools such as these can help avoid writing code that is tightly bound " "to a particular version of CPython, avoid reference counting errors, and " @@ -1362,7 +1396,7 @@ msgid "" "sources." msgstr "" -#: ../../c-api/intro.rst:851 +#: ../../c-api/intro.rst:883 msgid "" "These projects are not supported by the same people who maintain Python, and " "issues need to be raised with the projects directly. Remember to check that " @@ -1370,140 +1404,140 @@ msgid "" "outdated." msgstr "" -#: ../../c-api/intro.rst:858 +#: ../../c-api/intro.rst:890 msgid "" -"`Python Packaging User Guide: Binary Extensions `_" +"`Python Packaging User Guide: Binary Extensions `_" msgstr "" -#: ../../c-api/intro.rst:859 +#: ../../c-api/intro.rst:891 msgid "" "The Python Packaging User Guide not only covers several available tools that " "simplify the creation of binary extensions, but also discusses the various " "reasons why creating an extension module may be desirable in the first place." msgstr "" -#: ../../c-api/intro.rst:276 +#: ../../c-api/intro.rst:308 msgid "object" msgstr "object(物件)" -#: ../../c-api/intro.rst:276 +#: ../../c-api/intro.rst:308 msgid "type" msgstr "type(型別)" -#: ../../c-api/intro.rst:315 +#: ../../c-api/intro.rst:347 msgid "Py_INCREF (C function)" msgstr "Py_INCREF(C 函式)" -#: ../../c-api/intro.rst:315 +#: ../../c-api/intro.rst:347 msgid "Py_DECREF (C function)" msgstr "Py_DECREF(C 函式)" -#: ../../c-api/intro.rst:391 +#: ../../c-api/intro.rst:423 msgid "PyList_SetItem (C function)" msgstr "PyList_SetItem(C 函式)" -#: ../../c-api/intro.rst:391 +#: ../../c-api/intro.rst:423 msgid "PyTuple_SetItem (C function)" msgstr "PyTuple_SetItem(C 函式)" -#: ../../c-api/intro.rst:462 +#: ../../c-api/intro.rst:494 msgid "set_all()" msgstr "set_all()" -#: ../../c-api/intro.rst:481 +#: ../../c-api/intro.rst:513 msgid "PyList_GetItem (C function)" msgstr "PyList_GetItem(C 函式)" -#: ../../c-api/intro.rst:481 +#: ../../c-api/intro.rst:513 msgid "PySequence_GetItem (C function)" msgstr "PySequence_GetItem(C 函式)" -#: ../../c-api/intro.rst:511 +#: ../../c-api/intro.rst:543 msgid "sum_list()" msgstr "sum_list()" -#: ../../c-api/intro.rst:543 ../../c-api/intro.rst:635 +#: ../../c-api/intro.rst:575 ../../c-api/intro.rst:667 msgid "sum_sequence()" msgstr "sum_sequence()" -#: ../../c-api/intro.rst:578 +#: ../../c-api/intro.rst:610 msgid "PyErr_Occurred (C function)" msgstr "PyErr_Occurred(C 函式)" -#: ../../c-api/intro.rst:591 +#: ../../c-api/intro.rst:623 msgid "PyErr_SetString (C function)" msgstr "PyErr_SetString(C 函式)" -#: ../../c-api/intro.rst:591 ../../c-api/intro.rst:699 +#: ../../c-api/intro.rst:623 ../../c-api/intro.rst:731 msgid "PyErr_Clear (C function)" msgstr "PyErr_Clear(C 函式)" -#: ../../c-api/intro.rst:615 +#: ../../c-api/intro.rst:647 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../c-api/intro.rst:650 ../../c-api/intro.rst:697 +#: ../../c-api/intro.rst:682 ../../c-api/intro.rst:729 msgid "incr_item()" msgstr "incr_item()" -#: ../../c-api/intro.rst:699 +#: ../../c-api/intro.rst:731 msgid "PyErr_ExceptionMatches (C function)" msgstr "PyErr_ExceptionMatches(C 函式)" -#: ../../c-api/intro.rst:699 +#: ../../c-api/intro.rst:731 msgid "Py_XDECREF (C function)" msgstr "Py_XDECREF(C 函式)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "module" msgstr "module(模組)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "__main__" msgstr "__main__" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "sys" msgstr "sys" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "path" msgstr "path(路徑)" -#: ../../c-api/intro.rst:725 +#: ../../c-api/intro.rst:757 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/intro.rst:760 +#: ../../c-api/intro.rst:792 msgid "Py_GetPath (C function)" msgstr "Py_GetPath(C 函式)" -#: ../../c-api/intro.rst:760 +#: ../../c-api/intro.rst:792 msgid "Py_GetPrefix (C function)" msgstr "Py_GetPrefix(C 函式)" -#: ../../c-api/intro.rst:760 +#: ../../c-api/intro.rst:792 msgid "Py_GetExecPrefix (C function)" msgstr "Py_GetExecPrefix(C 函式)" -#: ../../c-api/intro.rst:760 +#: ../../c-api/intro.rst:792 msgid "Py_GetProgramFullPath (C function)" msgstr "Py_GetProgramFullPath(C 函式)" -#: ../../c-api/intro.rst:775 +#: ../../c-api/intro.rst:807 msgid "Py_IsInitialized (C function)" msgstr "Py_IsInitialized(C 函式)" diff --git a/library/json.po b/library/json.po index 604ad4da7c..786ffdfdb6 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,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: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) `_, specified " -"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, specified by :rfc:" +"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " -"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is " -"not a strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " +"strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) `_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 >> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': " -"obj.imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -161,8 +161,8 @@ msgstr "" ">>> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': " -"obj.imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -303,8 +303,8 @@ msgid "" "conversion table `." msgstr "" "參考這個 :ref:`Python-to-JSON 轉換表 `\\ 將 *obj* 序列化為" -"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" -"的 :term:`file-like object`)" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:" +"`file-like object`)" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing @@ -335,19 +335,21 @@ msgstr "" #: ../../library/json.rst:178 msgid "" -"If ``True``, keys that are not of a basic type " -"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " -"be skipped instead of raising a :exc:`TypeError`. Default ``False``." +"If ``True``, keys that are not of a basic type (:class:`str`, :class:`int`, :" +"class:`float`, :class:`bool`, ``None``) will be skipped instead of raising " +"a :exc:`TypeError`. Default ``False``." msgstr "" #: ../../library/json.rst:184 msgid "" "If ``True`` (the default), the output is guaranteed to have all incoming non-" -"ASCII characters escaped. If ``False``, these characters will be outputted " -"as-is." +"ASCII and non-printable characters escaped. If ``False``, all characters " +"will be outputted as-is, except for the characters that must be escaped: " +"quotation mark, reverse solidus, and the control characters U+0000 through " +"U+001F." msgstr "" -#: ../../library/json.rst:189 +#: ../../library/json.rst:191 msgid "" "If ``False``, the circular reference check for container types is skipped " "and a circular reference will result in a :exc:`RecursionError` (or worse). " @@ -357,7 +359,7 @@ msgstr "" "跳過,若有循環參照則最後將引發 :exc:`RecursionError`\\ (或其他更糟的錯誤)。" "預設為 ``True``。" -#: ../../library/json.rst:194 +#: ../../library/json.rst:196 msgid "" "If ``False``, serialization of out-of-range :class:`float` values (``nan``, " "``inf``, ``-inf``) will result in a :exc:`ValueError`, in strict compliance " @@ -369,14 +371,14 @@ msgstr "" "值),則將使用它們的 JavaScript 等效表示 (``NaN``, ``Infinity``, ``-" "Infinity``)。" -#: ../../library/json.rst:201 +#: ../../library/json.rst:203 msgid "" "If set, a custom JSON encoder with the :meth:`~JSONEncoder.default` method " "overridden, for serializing into custom datatypes. If ``None`` (the " "default), :class:`!JSONEncoder` is used." msgstr "" -#: ../../library/json.rst:208 +#: ../../library/json.rst:210 msgid "" "If a positive integer or string, JSON array elements and object members will " "be pretty-printed with that indent level. A positive integer indents that " @@ -385,7 +387,7 @@ msgid "" "inserted. If ``None`` (the default), the most compact representation is used." msgstr "" -#: ../../library/json.rst:218 +#: ../../library/json.rst:220 msgid "" "A two-tuple: ``(item_separator, key_separator)``. If ``None`` (the default), " "*separators* defaults to ``(', ', ': ')`` if *indent* is ``None``, and " @@ -396,42 +398,42 @@ msgstr "" "則 *separators* 被預設為 ``(', ', ': ')``,否則預設為 ``(',', ': ')``。想要獲" "得最緊湊的 JSON 表示形式,你可以指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:227 +#: ../../library/json.rst:229 msgid "" "A function that is called for objects that can't otherwise be serialized. It " -"should return a JSON encodable version of the object or raise " -"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." +"should return a JSON encodable version of the object or raise a :exc:" +"`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" -#: ../../library/json.rst:234 +#: ../../library/json.rst:236 msgid "" "If ``True``, dictionaries will be outputted sorted by key. Default ``False``." msgstr "" -#: ../../library/json.rst:238 ../../library/json.rst:523 +#: ../../library/json.rst:240 ../../library/json.rst:527 msgid "Allow strings for *indent* in addition to integers." msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" -#: ../../library/json.rst:241 ../../library/json.rst:531 +#: ../../library/json.rst:243 ../../library/json.rst:535 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" -#: ../../library/json.rst:244 ../../library/json.rst:343 +#: ../../library/json.rst:246 ../../library/json.rst:345 msgid "" "All optional parameters are now :ref:`keyword-only `." msgstr "" "所有可選參數現在都是\\ :ref:`僅限關鍵字 `\\ 參數了。" -#: ../../library/json.rst:253 +#: ../../library/json.rst:255 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table `. The arguments have the same meaning as " -"in :func:`dump`." +"table `. The arguments have the same meaning as in :func:" +"`dump`." msgstr "" -"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格" -"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" +"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:259 +#: ../../library/json.rst:261 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -444,7 +446,7 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:270 +#: ../../library/json.rst:272 msgid "" "Deserialize *fp* to a Python object using the :ref:`JSON-to-Python " "conversion table `." @@ -452,20 +454,20 @@ msgstr "" "使用此 :ref:`JSON-to-Python 轉換表 `\\ 將 *fp* 解碼為 " "Python 物件。" -#: ../../library/json.rst:273 +#: ../../library/json.rst:275 msgid "" "A ``.read()``-supporting :term:`text file` or :term:`binary file` containing " "the JSON document to be deserialized." msgstr "" -#: ../../library/json.rst:278 +#: ../../library/json.rst:280 msgid "" "If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " -"will be passed to the constructor of *cls*. If ``None`` (the " -"default), :class:`!JSONDecoder` is used." +"will be passed to the constructor of *cls*. If ``None`` (the default), :" +"class:`!JSONDecoder` is used." msgstr "" -#: ../../library/json.rst:285 +#: ../../library/json.rst:287 msgid "" "If set, a function that is called with the result of any JSON object literal " "decoded (a :class:`dict`). The return value of this function will be used " @@ -473,11 +475,11 @@ msgid "" "decoders, for example `JSON-RPC `_ class hinting. " "Default ``None``." msgstr "" -"如果有設定,會用解碼後的 JSON 物件字面值的結果(一個 :class:`dict`)來呼叫此函式。" -"此函式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器," -"例如 `JSON-RPC `_ 類別提示。預設為 ``None``。" +"如果有設定,會用解碼後的 JSON 物件字面值的結果(一個 :class:`dict`)來呼叫此" +"函式。此函式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器,例" +"如 `JSON-RPC `_ 類別提示。預設為 ``None``。" -#: ../../library/json.rst:295 +#: ../../library/json.rst:297 msgid "" "If set, a function that is called with the result of any JSON object literal " "decoded with an ordered list of pairs. The return value of this function " @@ -485,67 +487,65 @@ msgid "" "implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " "takes priority. Default ``None``." msgstr "" -"如果有設定,會用任何 JSON 物件字面值以有序對串列解碼的結果來呼叫此函式。" -"此函式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器。" -"如果也設定了 *object_hook*,以 *object_pairs_hook* 優先。預設為 ``None``。" +"如果有設定,會用任何 JSON 物件字面值以有序對串列解碼的結果來呼叫此函式。此函" +"式的回傳值將用來取代 :class:`dict`。此功能可用於實作自訂解碼器。如果也設定了 " +"*object_hook*,以 *object_pairs_hook* 優先。預設為 ``None``。" -#: ../../library/json.rst:305 +#: ../../library/json.rst:307 msgid "" "If set, a function that is called with the string of every JSON float to be " "decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " -"This can be used to parse JSON floats into custom datatypes, for " -"example :class:`decimal.Decimal`." +"This can be used to parse JSON floats into custom datatypes, for example :" +"class:`decimal.Decimal`." msgstr "" -"如果有設定,會用每個要被解碼的 JSON 浮點數字串來呼叫此函式。" -"如果為 ``None``\\ (預設值),則等同於 ``float(num_str)``。" -"此功能可用於將 JSON 浮點數剖析為自訂資料型別,例如 :class:`decimal.Decimal`。" +"如果有設定,會用每個要被解碼的 JSON 浮點數字串來呼叫此函式。如果為 " +"``None``\\ (預設值),則等同於 ``float(num_str)``。此功能可用於將 JSON 浮點" +"數剖析為自訂資料型別,例如 :class:`decimal.Decimal`。" -#: ../../library/json.rst:313 +#: ../../library/json.rst:315 msgid "" "If set, a function that is called with the string of every JSON int to be " "decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " -"This can be used to parse JSON integers into custom datatypes, for " -"example :class:`float`." +"This can be used to parse JSON integers into custom datatypes, for example :" +"class:`float`." msgstr "" -"如果有設定,會用每個要被解碼的 JSON 整數字串來呼叫此函式。" -"如果為 ``None``\\ (預設值),則等同於 ``int(num_str)``。" -"此功能可用於將 JSON 整數剖析為自訂資料型別,例如 :class:`float`。" +"如果有設定,會用每個要被解碼的 JSON 整數字串來呼叫此函式。如果為 ``None``\\ " +"(預設值),則等同於 ``int(num_str)``。此功能可用於將 JSON 整數剖析為自訂資料" +"型別,例如 :class:`float`。" -#: ../../library/json.rst:321 +#: ../../library/json.rst:323 msgid "" "If set, a function that is called with one of the following strings: ``'-" "Infinity'``, ``'Infinity'``, or ``'NaN'``. This can be used to raise an " "exception if invalid JSON numbers are encountered. Default ``None``." msgstr "" -"如果有設定,會用以下字串之一來呼叫此函式:``'-Infinity'``、" -"``'Infinity'`` 或 ``'NaN'``。此功能可用於在遇到無效的 JSON 數字時引發例外。" -"預設為 ``None``。" +"如果有設定,會用以下字串之一來呼叫此函式:``'-Infinity'``、``'Infinity'`` 或 " +"``'NaN'``。此功能可用於在遇到無效的 JSON 數字時引發例外。預設為 ``None``。" #: ../../library/json.rst:0 msgid "Raises" msgstr "" -#: ../../library/json.rst:329 +#: ../../library/json.rst:331 msgid "When the data being deserialized is not a valid JSON document." msgstr "當被去序列化的資料不是有效的 JSON 文件時。" -#: ../../library/json.rst:332 +#: ../../library/json.rst:334 msgid "" "When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " "encoded data." -msgstr "" -"當被去序列化的資料不包含 UTF-8、UTF-16 或 UTF-32 編碼資料時。" +msgstr "當被去序列化的資料不包含 UTF-8、UTF-16 或 UTF-32 編碼資料時。" -#: ../../library/json.rst:338 +#: ../../library/json.rst:340 msgid "Added the optional *object_pairs_hook* parameter." msgstr "新增可選的 *object_pairs_hook* 參數。" -#: ../../library/json.rst:339 +#: ../../library/json.rst:341 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" "遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:344 +#: ../../library/json.rst:346 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -553,7 +553,7 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:347 +#: ../../library/json.rst:349 msgid "" "The default *parse_int* of :func:`int` now limits the maximum length of the " "integer string via the interpreter's :ref:`integer string conversion length " @@ -563,18 +563,18 @@ msgstr "" "由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," "這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:355 +#: ../../library/json.rst:357 msgid "" "Identical to :func:`load`, but instead of a file-like object, deserialize " "*s* (a :class:`str`, :class:`bytes` or :class:`bytearray` instance " "containing a JSON document) to a Python object using this :ref:`conversion " "table `." msgstr "" -"與 :func:`load` 相同,但不是類檔案物件,而是使用\\ :ref:`轉換表 `\\ " -"將 *s*\\ (一個包含 JSON 文件的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 實例)" -"去序列化為 Python 物件。" +"與 :func:`load` 相同,但不是類檔案物件,而是使用\\ :ref:`轉換表 `\\ 將 *s*\\ (一個包含 JSON 文件的 :class:`str`、:class:`bytes` 或 :" +"class:`bytearray` 實例)去序列化為 Python 物件。" -#: ../../library/json.rst:360 +#: ../../library/json.rst:362 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -582,95 +582,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:364 +#: ../../library/json.rst:366 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:369 +#: ../../library/json.rst:371 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:373 +#: ../../library/json.rst:375 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:375 +#: ../../library/json.rst:377 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:380 ../../library/json.rst:468 +#: ../../library/json.rst:382 ../../library/json.rst:470 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:380 ../../library/json.rst:468 +#: ../../library/json.rst:382 ../../library/json.rst:470 msgid "Python" msgstr "Python" -#: ../../library/json.rst:382 ../../library/json.rst:470 +#: ../../library/json.rst:384 ../../library/json.rst:472 msgid "object" msgstr "object" -#: ../../library/json.rst:382 ../../library/json.rst:470 +#: ../../library/json.rst:384 ../../library/json.rst:472 msgid "dict" msgstr "dict" -#: ../../library/json.rst:384 ../../library/json.rst:472 +#: ../../library/json.rst:386 ../../library/json.rst:474 msgid "array" msgstr "array" -#: ../../library/json.rst:384 +#: ../../library/json.rst:386 msgid "list" msgstr "list" -#: ../../library/json.rst:386 ../../library/json.rst:474 +#: ../../library/json.rst:388 ../../library/json.rst:476 msgid "string" msgstr "string" -#: ../../library/json.rst:386 ../../library/json.rst:474 +#: ../../library/json.rst:388 ../../library/json.rst:476 msgid "str" msgstr "str" -#: ../../library/json.rst:388 +#: ../../library/json.rst:390 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:388 +#: ../../library/json.rst:390 msgid "int" msgstr "int" -#: ../../library/json.rst:390 +#: ../../library/json.rst:392 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:390 +#: ../../library/json.rst:392 msgid "float" msgstr "float" -#: ../../library/json.rst:392 ../../library/json.rst:478 +#: ../../library/json.rst:394 ../../library/json.rst:480 msgid "true" msgstr "true" -#: ../../library/json.rst:392 ../../library/json.rst:478 +#: ../../library/json.rst:394 ../../library/json.rst:480 msgid "True" msgstr "True" -#: ../../library/json.rst:394 ../../library/json.rst:480 +#: ../../library/json.rst:396 ../../library/json.rst:482 msgid "false" msgstr "false" -#: ../../library/json.rst:394 ../../library/json.rst:480 +#: ../../library/json.rst:396 ../../library/json.rst:482 msgid "False" msgstr "False" -#: ../../library/json.rst:396 ../../library/json.rst:482 +#: ../../library/json.rst:398 ../../library/json.rst:484 msgid "null" msgstr "null" -#: ../../library/json.rst:396 ../../library/json.rst:482 +#: ../../library/json.rst:398 ../../library/json.rst:484 msgid "None" msgstr "None" -#: ../../library/json.rst:399 +#: ../../library/json.rst:401 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -678,31 +678,31 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:402 +#: ../../library/json.rst:404 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations " -"(e.g. to support `JSON-RPC `_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations (e." +"g. to support `JSON-RPC `_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:407 +#: ../../library/json.rst:409 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of " -"the :class:`dict`. This feature can be used to implement custom decoders. " -"If *object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of the :class:" +"`dict`. This feature can be used to implement custom decoders. If " +"*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:413 +#: ../../library/json.rst:415 msgid "Added support for *object_pairs_hook*." msgstr "新增對於 *object_pairs_hook* 的支援。" -#: ../../library/json.rst:416 +#: ../../library/json.rst:418 msgid "" "*parse_float* is an optional function that will be called with the string of " "every JSON float to be decoded. By default, this is equivalent to " @@ -713,7 +713,7 @@ msgstr "" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:421 +#: ../../library/json.rst:423 msgid "" "*parse_int* is an optional function that will be called with the string of " "every JSON int to be decoded. By default, this is equivalent to " @@ -724,7 +724,7 @@ msgstr "" "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:426 +#: ../../library/json.rst:428 msgid "" "*parse_constant* is an optional function that will be called with one of the " "following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " @@ -734,7 +734,7 @@ msgstr "" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:430 +#: ../../library/json.rst:432 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -745,33 +745,33 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:435 +#: ../../library/json.rst:437 msgid "" -"If the data being deserialized is not a valid JSON document, " -"a :exc:`JSONDecodeError` will be raised." +"If the data being deserialized is not a valid JSON document, a :exc:" +"`JSONDecodeError` will be raised." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" -"發 :exc:`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" +"`JSONDecodeError` 例外。" -#: ../../library/json.rst:438 ../../library/json.rst:539 +#: ../../library/json.rst:440 ../../library/json.rst:543 msgid "All parameters are now :ref:`keyword-only `." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" -#: ../../library/json.rst:443 +#: ../../library/json.rst:445 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:448 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:451 +#: ../../library/json.rst:453 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -780,43 +780,43 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:455 +#: ../../library/json.rst:457 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:461 +#: ../../library/json.rst:463 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:463 +#: ../../library/json.rst:465 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:472 +#: ../../library/json.rst:474 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:476 +#: ../../library/json.rst:478 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:476 +#: ../../library/json.rst:478 msgid "number" msgstr "number" -#: ../../library/json.rst:485 +#: ../../library/json.rst:487 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:488 +#: ../../library/json.rst:490 msgid "" -"To extend this to recognize other objects, subclass and implement " -"a :meth:`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement a :meth:" +"`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -824,28 +824,30 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:493 +#: ../../library/json.rst:495 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are " -"not :class:`str`, :class:`int`, :class:`float`, :class:`bool` or ``None``. " -"If *skipkeys* is true, such items are simply skipped." +"trying to encode keys that are not :class:`str`, :class:`int`, :class:" +"`float`, :class:`bool` or ``None``. If *skipkeys* is true, such items are " +"simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不" -"是 :class:`str`、:class:`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵" -"值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳" -"過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" +"`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵值時,將引發 :exc:" +"`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" -#: ../../library/json.rst:497 +#: ../../library/json.rst:499 +#, fuzzy msgid "" "If *ensure_ascii* is true (the default), the output is guaranteed to have " -"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " -"these characters will be output as-is." +"all incoming non-ASCII and non-printable characters escaped. If " +"*ensure_ascii* is false, all characters will be output as-is, except for the " +"characters that must be escaped: quotation mark, reverse solidus, and the " +"control characters U+0000 through U+001F." msgstr "" "如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " "字元都會被跳脫。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" -#: ../../library/json.rst:501 +#: ../../library/json.rst:505 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -853,10 +855,10 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" -"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" +"`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:506 +#: ../../library/json.rst:510 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -868,7 +870,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:512 +#: ../../library/json.rst:516 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -878,7 +880,7 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:516 +#: ../../library/json.rst:520 msgid "" "If *indent* is a non-negative integer or string, then JSON array elements " "and object members will be pretty-printed with that indent level. An indent " @@ -892,7 +894,7 @@ msgstr "" "值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" "果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" -#: ../../library/json.rst:526 +#: ../../library/json.rst:530 msgid "" "If specified, *separators* should be an ``(item_separator, key_separator)`` " "tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " @@ -904,35 +906,35 @@ msgstr "" "')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" "指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:534 +#: ../../library/json.rst:538 msgid "" "If specified, *default* should be a function that gets called for objects " "that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not " -"specified, :exc:`TypeError` is raised." +"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" +"`TypeError` is raised." msgstr "" "如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" "應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" "引發 :exc:`TypeError`。" -#: ../../library/json.rst:545 +#: ../../library/json.rst:549 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise " -"a :exc:`TypeError`)." +"object for *o*, or calls the base implementation (to raise a :exc:" +"`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:549 +#: ../../library/json.rst:553 msgid "" -"For example, to support arbitrary iterators, you could " -"implement :meth:`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could implement :meth:" +"`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" -"的 :meth:`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" +"`~JSONEncoder.default`: ::" -#: ../../library/json.rst:552 +#: ../../library/json.rst:556 msgid "" "def default(self, o):\n" " try:\n" @@ -954,13 +956,13 @@ msgstr "" " # 讓基底類別的預設方法引發 TypeError\n" " return super().default(o)" -#: ../../library/json.rst:565 +#: ../../library/json.rst:569 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:568 +#: ../../library/json.rst:572 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -968,7 +970,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:574 +#: ../../library/json.rst:578 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -976,7 +978,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:577 +#: ../../library/json.rst:581 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -984,39 +986,39 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:582 +#: ../../library/json.rst:586 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:586 +#: ../../library/json.rst:590 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:590 +#: ../../library/json.rst:594 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:594 +#: ../../library/json.rst:598 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:598 +#: ../../library/json.rst:602 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:602 +#: ../../library/json.rst:606 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:606 +#: ../../library/json.rst:610 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:612 +#: ../../library/json.rst:616 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:614 +#: ../../library/json.rst:618 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " @@ -1029,7 +1031,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:620 +#: ../../library/json.rst:624 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -1037,17 +1039,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:623 +#: ../../library/json.rst:627 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:624 +#: ../../library/json.rst:628 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:627 +#: ../../library/json.rst:631 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -1056,11 +1058,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:632 +#: ../../library/json.rst:636 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:634 +#: ../../library/json.rst:638 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -1069,27 +1071,27 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:637 +#: ../../library/json.rst:641 +#, fuzzy msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " -"resulting strings only contain ASCII characters." +"resulting strings only contain printable ASCII characters." msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會跳脫所有非 ASCII 字元。" -#: ../../library/json.rst:641 +#: ../../library/json.rst:645 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " "`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" -"與 :class:`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的" -"問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" +"`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" -#: ../../library/json.rst:646 +#: ../../library/json.rst:650 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -1102,24 +1104,24 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:652 +#: ../../library/json.rst:656 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the " -"original :class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the original :" +"class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:660 +#: ../../library/json.rst:664 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:662 +#: ../../library/json.rst:666 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1128,7 +1130,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:666 +#: ../../library/json.rst:670 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1143,7 +1145,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:677 +#: ../../library/json.rst:681 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1152,11 +1154,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:683 +#: ../../library/json.rst:687 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:685 +#: ../../library/json.rst:689 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1167,7 +1169,7 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:690 +#: ../../library/json.rst:694 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" @@ -1177,15 +1179,15 @@ msgstr "" ">>> json.loads(weird_json)\n" "{'x': 3}" -#: ../../library/json.rst:694 +#: ../../library/json.rst:698 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_pairs_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:698 +#: ../../library/json.rst:702 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:700 +#: ../../library/json.rst:704 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1199,37 +1201,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:707 +#: ../../library/json.rst:711 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:712 +#: ../../library/json.rst:716 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:714 +#: ../../library/json.rst:718 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:716 +#: ../../library/json.rst:720 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:717 +#: ../../library/json.rst:721 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:718 +#: ../../library/json.rst:722 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:719 +#: ../../library/json.rst:723 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:721 +#: ../../library/json.rst:725 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1237,7 +1239,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:724 +#: ../../library/json.rst:728 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1252,31 +1254,30 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:737 +#: ../../library/json.rst:741 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/json.rst:742 +#: ../../library/json.rst:746 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:746 +#: ../../library/json.rst:750 msgid "" "The :mod:`json` module can be invoked as a script via ``python -m json`` to " "validate and pretty-print JSON objects. The :mod:`json.tool` submodule " "implements this interface." msgstr "" -#: ../../library/json.rst:750 +#: ../../library/json.rst:754 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not " -"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " -"respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not specified, :" +"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " -"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" +"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:753 +#: ../../library/json.rst:757 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json\n" "{\n" @@ -1292,7 +1293,7 @@ msgstr "" "$ echo '{1.2:3.4}' | python -m json\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" -#: ../../library/json.rst:762 +#: ../../library/json.rst:766 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1300,22 +1301,22 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:767 +#: ../../library/json.rst:771 msgid "" "The :mod:`json` module may now be directly executed as ``python -m json``. " "For backwards compatibility, invoking the CLI as ``python -m json.tool`` " "remains supported." msgstr "" -#: ../../library/json.rst:774 +#: ../../library/json.rst:778 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/json.rst:778 +#: ../../library/json.rst:782 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:780 +#: ../../library/json.rst:784 msgid "" "$ python -m json mp_films.json\n" "[\n" @@ -1341,45 +1342,45 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:794 +#: ../../library/json.rst:798 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:798 +#: ../../library/json.rst:802 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" -"到 :data:`sys.stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." +"stdout`。" -#: ../../library/json.rst:803 +#: ../../library/json.rst:807 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:809 +#: ../../library/json.rst:813 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動跳脫功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:815 +#: ../../library/json.rst:819 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:821 +#: ../../library/json.rst:825 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:827 +#: ../../library/json.rst:831 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:831 +#: ../../library/json.rst:835 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:832 +#: ../../library/json.rst:836 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/library/sys.po b/library/sys.po index 1f291b5ae4..4b6bbf70e8 100644 --- a/library/sys.po +++ b/library/sys.po @@ -6,7 +6,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: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,10 +44,10 @@ msgstr "" #: ../../library/sys.rst:25 ../../library/sys.rst:298 ../../library/sys.rst:368 #: ../../library/sys.rst:789 ../../library/sys.rst:807 -#: ../../library/sys.rst:1056 ../../library/sys.rst:1662 -#: ../../library/sys.rst:1905 ../../library/sys.rst:1920 -#: ../../library/sys.rst:1928 ../../library/sys.rst:1966 -#: ../../library/sys.rst:1982 ../../library/sys.rst:2229 +#: ../../library/sys.rst:1056 ../../library/sys.rst:1666 +#: ../../library/sys.rst:1909 ../../library/sys.rst:1924 +#: ../../library/sys.rst:1932 ../../library/sys.rst:1970 +#: ../../library/sys.rst:1986 ../../library/sys.rst:2233 msgid "Availability" msgstr "可用性" @@ -75,8 +75,8 @@ msgid "" "particular, malicious code can trivially disable or bypass hooks added using " "this function. At a minimum, any security-sensitive hooks must be added " "using the C API :c:func:`PySys_AddAuditHook` before initialising the " -"runtime, and any modules allowing arbitrary memory modification (such " -"as :mod:`ctypes`) should be completely removed or closely monitored." +"runtime, and any modules allowing arbitrary memory modification (such as :" +"mod:`ctypes`) should be completely removed or closely monitored." msgstr "" #: ../../library/sys.rst:49 ../../library/sys.rst:51 @@ -87,10 +87,10 @@ msgid "" "and the exception suppressed. As a result, callers cannot assume that their " "hook has been added unless they control all existing hooks." msgstr "" -"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 " -"``sys.addaudithook`` 的稽核事件。如果任何現有的 hook 引發" -"從 :class:`RuntimeError` 衍生的例外,則不會添加新的 hook 並抑制異常。因此,除" -"非呼叫者控制所有已存在的 hook,他們不能假設他們的 hook 已被添加。" +"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 ``sys." +"addaudithook`` 的稽核事件。如果任何現有的 hook 引發從 :class:`RuntimeError` " +"衍生的例外,則不會添加新的 hook 並抑制異常。因此,除非呼叫者控制所有已存在的 " +"hook,他們不能假設他們的 hook 已被添加。" #: ../../library/sys.rst:58 msgid "" @@ -170,8 +170,8 @@ msgstr "" #: ../../library/sys.rst:119 msgid "" -"Hooks are added using the :func:`sys.addaudithook` " -"or :c:func:`PySys_AddAuditHook` functions." +"Hooks are added using the :func:`sys.addaudithook` or :c:func:" +"`PySys_AddAuditHook` functions." msgstr "" #: ../../library/sys.rst:122 @@ -195,11 +195,11 @@ msgstr "" #: ../../library/sys.rst:135 msgid "" -"When running under :ref:`sys-path-init-virtual-" -"environments`, :data:`exec_prefix` gets overwritten to the virtual " -"environment prefix. :data:`base_exec_prefix`, conversely, does not change, " -"and always points to the base Python installation. Refer to :ref:`sys-path-" -"init-virtual-environments` for more information." +"When running under :ref:`sys-path-init-virtual-environments`, :data:" +"`exec_prefix` gets overwritten to the virtual environment prefix. :data:" +"`base_exec_prefix`, conversely, does not change, and always points to the " +"base Python installation. Refer to :ref:`sys-path-init-virtual-environments` " +"for more information." msgstr "" #: ../../library/sys.rst:146 @@ -243,10 +243,9 @@ msgstr "" #: ../../library/sys.rst:179 msgid "" -"Tracing is suspended while calling a tracing function set " -"by :func:`settrace` or :func:`setprofile` to avoid infinite " -"recursion. :func:`!call_tracing` enables explicit recursion of the tracing " -"function." +"Tracing is suspended while calling a tracing function set by :func:" +"`settrace` or :func:`setprofile` to avoid infinite recursion. :func:`!" +"call_tracing` enables explicit recursion of the tracing function." msgstr "" #: ../../library/sys.rst:186 @@ -317,8 +316,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``sys._current_exceptions``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." +"_current_exceptions``。" #: ../../library/sys.rst:239 msgid "" @@ -345,30 +344,29 @@ msgstr "" #: ../../library/sys.rst:256 msgid "" -"The default implementation first consults the environment " -"variable :envvar:`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this " -"function returns immediately; i.e. it is a no-op. If the environment " -"variable is not set, or is set to the empty string, ``pdb.set_trace()`` is " -"called. Otherwise this variable should name a function to run, using " -"Python's dotted-import nomenclature, e.g. " -"``package.subpackage.module.function``. In this case, " +"The default implementation first consults the environment variable :envvar:" +"`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " +"immediately; i.e. it is a no-op. If the environment variable is not set, or " +"is set to the empty string, ``pdb.set_trace()`` is called. Otherwise this " +"variable should name a function to run, using Python's dotted-import " +"nomenclature, e.g. ``package.subpackage.module.function``. In this case, " "``package.subpackage.module`` would be imported and the resulting module " "must have a callable named ``function()``. This is run, passing in " -"``*args`` and ``**kws``, and whatever ``function()`` returns, " -"``sys.breakpointhook()`` returns to the built-in :func:`breakpoint` function." +"``*args`` and ``**kws``, and whatever ``function()`` returns, ``sys." +"breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" #: ../../library/sys.rst:268 msgid "" -"Note that if anything goes wrong while importing the callable named " -"by :envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " +"Note that if anything goes wrong while importing the callable named by :" +"envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" #: ../../library/sys.rst:272 msgid "" -"Also note that if ``sys.breakpointhook()`` is overridden " -"programmatically, :envvar:`PYTHONBREAKPOINT` is *not* consulted." +"Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" +"envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" #: ../../library/sys.rst:279 @@ -396,19 +394,19 @@ msgstr "" #: ../../library/sys.rst:303 msgid "" -"If *value* is not ``None``, this function prints ``repr(value)`` to " -"``sys.stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is " -"not encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " -"handler (which is probably ``'strict'``), encode it to " -"``sys.stdout.encoding`` with ``'backslashreplace'`` error handler." +"If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." +"stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " +"encodable to ``sys.stdout.encoding`` with ``sys.stdout.errors`` error " +"handler (which is probably ``'strict'``), encode it to ``sys.stdout." +"encoding`` with ``'backslashreplace'`` error handler." msgstr "" #: ../../library/sys.rst:309 msgid "" -"``sys.displayhook`` is called on the result of evaluating " -"an :term:`expression` entered in an interactive Python session. The display " -"of these values can be customized by assigning another one-argument function " -"to ``sys.displayhook``." +"``sys.displayhook`` is called on the result of evaluating an :term:" +"`expression` entered in an interactive Python session. The display of these " +"values can be customized by assigning another one-argument function to ``sys." +"displayhook``." msgstr "" #: ../../library/sys.rst:313 @@ -444,9 +442,9 @@ msgstr "" msgid "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " -"depending on the :option:`-B` command line option and " -"the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable, but you can set " -"it yourself to control bytecode file generation." +"depending on the :option:`-B` command line option and the :envvar:" +"`PYTHONDONTWRITEBYTECODE` environment variable, but you can set it yourself " +"to control bytecode file generation." msgstr "" #: ../../library/sys.rst:348 @@ -497,9 +495,9 @@ msgstr "" #: ../../library/sys.rst:385 msgid "" "This value is initially set based on the value of the :option:`-X` " -"``pycache_prefix=PATH`` command-line option or " -"the :envvar:`PYTHONPYCACHEPREFIX` environment variable (command-line takes " -"precedence). If neither are set, it is ``None``." +"``pycache_prefix=PATH`` command-line option or the :envvar:" +"`PYTHONPYCACHEPREFIX` environment variable (command-line takes precedence). " +"If neither are set, it is ``None``." msgstr "" #: ../../library/sys.rst:395 @@ -524,15 +522,15 @@ msgid "" "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " "hook has been set, ``hook`` may be ``None``. If any hook raises an exception " "derived from :class:`RuntimeError` the call to the hook will be suppressed. " -"Otherwise, the audit hook exception will be reported as unraisable and " -"``sys.excepthook`` will be called." +"Otherwise, the audit hook exception will be reported as unraisable and ``sys." +"excepthook`` will be called." msgstr "" #: ../../library/sys.rst:415 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " -"the :func:`threading.excepthook` function handles exception raised " -"by :func:`threading.Thread.run`." +"the :func:`threading.excepthook` function handles exception raised by :func:" +"`threading.Thread.run`." msgstr "" #: ../../library/sys.rst:425 @@ -568,11 +566,11 @@ msgstr "" msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " -"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, " -"e.__traceback__)``. That is, a tuple containing the type of the exception (a " -"subclass of :exc:`BaseException`), the exception itself, and " -"a :ref:`traceback object ` which typically encapsulates " -"the call stack at the point where the exception last occurred." +"return ``e``), :func:`exc_info` returns the tuple ``(type(e), e, e." +"__traceback__)``. That is, a tuple containing the type of the exception (a " +"subclass of :exc:`BaseException`), the exception itself, and a :ref:" +"`traceback object ` which typically encapsulates the call " +"stack at the point where the exception last occurred." msgstr "" #: ../../library/sys.rst:463 @@ -585,8 +583,8 @@ msgstr "" msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " -"handled, the changes are reflected in the results of subsequent calls " -"to :func:`exc_info`." +"handled, the changes are reflected in the results of subsequent calls to :" +"func:`exc_info`." msgstr "" #: ../../library/sys.rst:474 @@ -595,22 +593,21 @@ msgid "" "dependent Python files are installed; by default, this is also ``'/usr/" "local'``. This can be set at build time with the ``--exec-prefix`` argument " "to the :program:`configure` script. Specifically, all configuration files " -"(e.g. the :file:`pyconfig.h` header file) are installed in the " -"directory :file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library " -"modules are installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, " -"where *X.Y* is the version number of Python, for example ``3.2``." +"(e.g. the :file:`pyconfig.h` header file) are installed in the directory :" +"file:`{exec_prefix}/lib/python{X.Y}/config`, and shared library modules are " +"installed in :file:`{exec_prefix}/lib/python{X.Y}/lib-dynload`, where *X.Y* " +"is the version number of Python, for example ``3.2``." msgstr "" #: ../../library/sys.rst:485 msgid "" -"If a :ref:`virtual environment ` is in effect, " -"this :data:`exec_prefix` will point to the virtual environment. The value " -"for the Python installation will still be available, " -"via :data:`base_exec_prefix`. Refer to :ref:`sys-path-init-virtual-" -"environments` for more information." +"If a :ref:`virtual environment ` is in effect, this :data:" +"`exec_prefix` will point to the virtual environment. The value for the " +"Python installation will still be available, via :data:`base_exec_prefix`. " +"Refer to :ref:`sys-path-init-virtual-environments` for more information." msgstr "" -#: ../../library/sys.rst:492 ../../library/sys.rst:1627 +#: ../../library/sys.rst:492 ../../library/sys.rst:1631 msgid "" "When running under a :ref:`virtual environment `, :data:`prefix` " "and :data:`exec_prefix` are now set to the virtual environment prefix by " @@ -660,9 +657,9 @@ msgstr "" #: ../../library/sys.rst:529 msgid "" -"If an error occurs in the cleanup after the Python interpreter has " -"caught :exc:`SystemExit` (such as an error flushing buffered data in the " -"standard streams), the exit status is changed to 120." +"If an error occurs in the cleanup after the Python interpreter has caught :" +"exc:`SystemExit` (such as an error flushing buffered data in the standard " +"streams), the exit status is changed to 120." msgstr "" #: ../../library/sys.rst:537 @@ -748,14 +745,14 @@ msgstr "" #: ../../library/sys.rst:602 msgid "" -":option:`-X thread_inherit_context <-X>` " -"and :envvar:`PYTHON_THREAD_INHERIT_CONTEXT`" +":option:`-X thread_inherit_context <-X>` and :envvar:" +"`PYTHON_THREAD_INHERIT_CONTEXT`" msgstr "" #: ../../library/sys.rst:606 msgid "" -":option:`-X context_aware_warnings <-X>` " -"and :envvar:`PYTHON_CONTEXT_AWARE_WARNINGS`" +":option:`-X context_aware_warnings <-X>` and :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS`" msgstr "" #: ../../library/sys.rst:610 @@ -976,8 +973,8 @@ msgstr "" #: ../../library/sys.rst:728 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " -"``s`` is any string representing a decimal number with at most :attr:`!" -"sys.float_info.dig` significant digits, then converting ``s`` to a float and " +"``s`` is any string representing a decimal number with at most :attr:`!sys." +"float_info.dig` significant digits, then converting ``s`` to a float and " "back again will recover a string representing the same decimal value::" msgstr "" @@ -1019,9 +1016,9 @@ msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " "debugging memory leaks. Because of the interpreter's internal caches, the " -"result can vary from call to call; you may have to " -"call :func:`_clear_internal_caches` and :func:`gc.collect` to get more " -"predictable results." +"result can vary from call to call; you may have to call :func:" +"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " +"results." msgstr "" #: ../../library/sys.rst:770 @@ -1059,8 +1056,8 @@ msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` to convert between Unicode filenames and bytes " -"filenames. The filesystem error handler is returned " -"from :func:`getfilesystemencodeerrors`." +"filenames. The filesystem error handler is returned from :func:" +"`getfilesystemencodeerrors`." msgstr "" #: ../../library/sys.rst:818 @@ -1080,9 +1077,9 @@ msgstr "" #: ../../library/sys.rst:826 ../../library/sys.rst:854 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: " -"see :c:member:`~PyConfig.filesystem_encoding` " -"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." +"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" +"c:type:`PyConfig`." msgstr "" #: ../../library/sys.rst:831 @@ -1091,8 +1088,8 @@ msgstr ":func:`getfilesystemencoding` 的結果不再為 ``None``。" #: ../../library/sys.rst:834 msgid "" -"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` " -"and :func:`_enablelegacywindowsfsencoding` for more information." +"Windows is no longer guaranteed to return ``'mbcs'``. See :pep:`529` and :" +"func:`_enablelegacywindowsfsencoding` for more information." msgstr "" #: ../../library/sys.rst:838 @@ -1105,8 +1102,8 @@ msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " "` to convert between Unicode " -"filenames and bytes filenames. The filesystem encoding is returned " -"from :func:`getfilesystemencoding`." +"filenames and bytes filenames. The filesystem encoding is returned from :" +"func:`getfilesystemencoding`." msgstr "" #: ../../library/sys.rst:863 @@ -1125,10 +1122,10 @@ msgstr "" #: ../../library/sys.rst:874 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects " -"are :term:`immortal` and have a very high refcount that does not reflect the " -"actual number of references. Consequently, do not rely on the returned " -"value to be accurate, other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" #: ../../library/sys.rst:882 @@ -1147,8 +1144,8 @@ msgstr "" msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " -"causing an overflow of the C stack and crashing Python. It can be set " -"by :func:`setrecursionlimit`." +"causing an overflow of the C stack and crashing Python. It can be set by :" +"func:`setrecursionlimit`." msgstr "" #: ../../library/sys.rst:899 @@ -1187,8 +1184,8 @@ msgstr "" #: ../../library/sys.rst:920 msgid "" -"Return the interpreter's \"thread switch interval\" in seconds; " -"see :func:`setswitchinterval`." +"Return the interpreter's \"thread switch interval\" in seconds; see :func:" +"`setswitchinterval`." msgstr "" #: ../../library/sys.rst:928 @@ -1205,8 +1202,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." msgstr "" -"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` " -"``sys._getframe``。" +"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys." +"_getframe``。" #: ../../library/sys.rst:937 ../../library/sys.rst:953 msgid "" @@ -1228,8 +1225,8 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." msgstr "" -"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` " -"``sys._getframemodulename``。" +"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." +"_getframemodulename``。" #: ../../library/sys.rst:961 msgid "" @@ -1248,14 +1245,13 @@ msgstr "" msgid "" "Objects from the list are not safe to use. Specifically, the result will " "include objects from all interpreters that share their object allocator " -"state (that is, ones created " -"with :c:member:`PyInterpreterConfig.use_main_obmalloc` set to 1 or " -"using :c:func:`Py_NewInterpreter`, and the :ref:`main interpreter `). Mixing objects from different interpreters may lead " -"to crashes or other unexpected behavior." +"state (that is, ones created with :c:member:`PyInterpreterConfig." +"use_main_obmalloc` set to 1 or using :c:func:`Py_NewInterpreter`, and the :" +"ref:`main interpreter `). Mixing objects from " +"different interpreters may lead to crashes or other unexpected behavior." msgstr "" -#: ../../library/sys.rst:980 ../../library/sys.rst:1384 +#: ../../library/sys.rst:980 ../../library/sys.rst:1388 msgid "" "This function should be used for specialized purposes only. It is not " "guaranteed to exist in all implementations of Python." @@ -1288,9 +1284,9 @@ msgid "" "*service_pack_minor*, *service_pack_major*, *suite_mask*, *product_type* and " "*platform_version*. *service_pack* contains a string, *platform_version* a 3-" "tuple and all other values are integers. The components can also be accessed " -"by name, so ``sys.getwindowsversion()[0]`` is equivalent to " -"``sys.getwindowsversion().major``. For compatibility with prior versions, " -"only the first 5 elements are retrievable by indexing." +"by name, so ``sys.getwindowsversion()[0]`` is equivalent to ``sys." +"getwindowsversion().major``. For compatibility with prior versions, only the " +"first 5 elements are retrievable by indexing." msgstr "" #: ../../library/sys.rst:1026 @@ -1367,19 +1363,19 @@ msgstr "新增 *platform_version*" #: ../../library/sys.rst:1068 msgid "" -"Returns an *asyncgen_hooks* object, which is similar to " -"a :class:`~collections.namedtuple` of the form ``(firstiter, finalizer)``, " -"where *firstiter* and *finalizer* are expected to be either ``None`` or " -"functions which take an :term:`asynchronous generator iterator` as an " -"argument, and are used to schedule finalization of an asynchronous generator " -"by an event loop." +"Returns an *asyncgen_hooks* object, which is similar to a :class:" +"`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " +"*firstiter* and *finalizer* are expected to be either ``None`` or functions " +"which take an :term:`asynchronous generator iterator` as an argument, and " +"are used to schedule finalization of an asynchronous generator by an event " +"loop." msgstr "" #: ../../library/sys.rst:1075 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1079 ../../library/sys.rst:1874 +#: ../../library/sys.rst:1079 ../../library/sys.rst:1878 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1387,11 +1383,11 @@ msgstr "" #: ../../library/sys.rst:1085 msgid "" -"Get the current coroutine origin tracking depth, as set " -"by :func:`set_coroutine_origin_tracking_depth`." +"Get the current coroutine origin tracking depth, as set by :func:" +"`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1091 ../../library/sys.rst:1895 +#: ../../library/sys.rst:1091 ../../library/sys.rst:1899 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1436,10 +1432,15 @@ msgid "The size of the seed key of the hash algorithm" msgstr "" #: ../../library/sys.rst:1135 -msgid "Added *algorithm*, *hash_bits* and *seed_bits*" +msgid "Cutoff for small string DJBX33A optimization in range ``[1, cutoff)``." +msgstr "" + +#: ../../library/sys.rst:1139 +#, fuzzy +msgid "Added *algorithm*, *hash_bits*, *seed_bits*, and *cutoff*." msgstr "新增 *algorithm*、*hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:1141 +#: ../../library/sys.rst:1145 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1447,7 +1448,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:1145 +#: ../../library/sys.rst:1149 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1457,7 +1458,7 @@ msgid "" " ..." msgstr "" -#: ../../library/sys.rst:1152 +#: ../../library/sys.rst:1156 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1465,25 +1466,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:1157 +#: ../../library/sys.rst:1161 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:1162 +#: ../../library/sys.rst:1166 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:1166 +#: ../../library/sys.rst:1170 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:1170 +#: ../../library/sys.rst:1174 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1495,13 +1496,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:1180 +#: ../../library/sys.rst:1184 msgid "" -"*hexversion* is the implementation version in hexadecimal format, " -"like :data:`sys.hexversion`." +"*hexversion* is the implementation version in hexadecimal format, like :data:" +"`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:1183 +#: ../../library/sys.rst:1187 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1510,7 +1511,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:1190 +#: ../../library/sys.rst:1194 msgid "" "*supports_isolated_interpreters* is a boolean value, whether this " "implementation supports multiple isolated interpreters. It is ``True`` for " @@ -1518,68 +1519,67 @@ msgid "" "level :mod:`!_interpreters` module." msgstr "" -#: ../../library/sys.rst:1197 +#: ../../library/sys.rst:1201 msgid ":pep:`684`, :pep:`734`, and :mod:`concurrent.interpreters`." msgstr "" -#: ../../library/sys.rst:1199 +#: ../../library/sys.rst:1203 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " -"underscore, and are not described here. Regardless of its " -"contents, :data:`sys.implementation` will not change during a run of the " -"interpreter, nor between implementation versions. (It may change between " -"Python language versions, however.) See :pep:`421` for more information." +"underscore, and are not described here. Regardless of its contents, :data:" +"`sys.implementation` will not change during a run of the interpreter, nor " +"between implementation versions. (It may change between Python language " +"versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1208 +#: ../../library/sys.rst:1212 msgid "Added ``supports_isolated_interpreters`` field." msgstr "" -#: ../../library/sys.rst:1213 +#: ../../library/sys.rst:1217 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1218 +#: ../../library/sys.rst:1222 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:1223 +#: ../../library/sys.rst:1227 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: ../../library/sys.rst:1228 +#: ../../library/sys.rst:1232 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: ../../library/sys.rst:1232 +#: ../../library/sys.rst:1236 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:1237 +#: ../../library/sys.rst:1241 msgid "" -"The minimum non-zero value " -"for :func:`sys.set_int_max_str_digits`, :envvar:`PYTHONINTMAXSTRDIGITS`, " -"or :option:`-X int_max_str_digits <-X>`." +"The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" +"`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:1244 +#: ../../library/sys.rst:1248 msgid "" -"Added :attr:`~int_info.default_max_str_digits` " -"and :attr:`~int_info.str_digits_check_threshold`." +"Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." +"str_digits_check_threshold`." msgstr "" -"新增 :attr:`~int_info.default_max_str_digits` " -"和 :attr:`~int_info.str_digits_check_threshold`。" +"新增 :attr:`~int_info.default_max_str_digits` 和 :attr:`~int_info." +"str_digits_check_threshold`。" -#: ../../library/sys.rst:1250 +#: ../../library/sys.rst:1254 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:1256 ../../library/sys.rst:1258 +#: ../../library/sys.rst:1260 ../../library/sys.rst:1262 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1267 +#: ../../library/sys.rst:1271 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1606,44 +1606,44 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1275 +#: ../../library/sys.rst:1279 msgid "" "Interned strings are not :term:`immortal`; you must keep a reference to the " "return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1281 +#: ../../library/sys.rst:1285 msgid "" "Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " "is disabled." msgstr "" -#: ../../library/sys.rst:1288 ../../library/sys.rst:1396 +#: ../../library/sys.rst:1292 ../../library/sys.rst:1400 msgid "It is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:1292 +#: ../../library/sys.rst:1296 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1295 +#: ../../library/sys.rst:1299 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "另請參閱 :exc:`PythonFinalizationError` 例外。" -#: ../../library/sys.rst:1301 +#: ../../library/sys.rst:1305 msgid "Utilities for observing just-in-time compilation." msgstr "" -#: ../../library/sys.rst:1305 +#: ../../library/sys.rst:1309 msgid "" -"JIT compilation is an *experimental implementation detail* of CPython. " -"``sys._jit`` is not guaranteed to exist or behave the same way in all Python " +"JIT compilation is an *experimental implementation detail* of CPython. ``sys." +"_jit`` is not guaranteed to exist or behave the same way in all Python " "implementations, versions, or build configurations." msgstr "" -#: ../../library/sys.rst:1313 +#: ../../library/sys.rst:1317 msgid "" "Return ``True`` if the current Python executable supports JIT compilation, " "and ``False`` otherwise. This can be controlled by building CPython with " @@ -1651,28 +1651,28 @@ msgid "" "experimental-jit` option on all other platforms." msgstr "" -#: ../../library/sys.rst:1320 +#: ../../library/sys.rst:1324 msgid "" "Return ``True`` if JIT compilation is enabled for the current Python process " "(implies :func:`sys._jit.is_available`), and ``False`` otherwise. If JIT " -"compilation is available, this can be controlled by setting " -"the :envvar:`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` " -"(enabled) at interpreter startup." +"compilation is available, this can be controlled by setting the :envvar:" +"`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` (enabled) at " +"interpreter startup." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1332 msgid "" "Return ``True`` if the topmost Python frame is currently executing JIT code " "(implies :func:`sys._jit.is_enabled`), and ``False`` otherwise." msgstr "" -#: ../../library/sys.rst:1333 +#: ../../library/sys.rst:1337 msgid "" "This function is intended for testing and debugging the JIT itself. It " "should be avoided for any other purpose." msgstr "" -#: ../../library/sys.rst:1338 +#: ../../library/sys.rst:1342 msgid "" "Due to the nature of tracing JIT compilers, repeated calls to this function " "may give surprising results. For example, branching on its return value will " @@ -1680,7 +1680,7 @@ msgid "" "entered or exited):" msgstr "" -#: ../../library/sys.rst:1343 +#: ../../library/sys.rst:1347 msgid "" ">>> for warmup in range(BIG_NUMBER):\n" "... # This line is \"hot\", and is eventually JIT-compiled:\n" @@ -1695,7 +1695,7 @@ msgid "" "AssertionError" msgstr "" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1363 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1706,100 +1706,99 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1375 msgid "" "Return :const:`True` if the given object is :term:`immortal`, :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1376 +#: ../../library/sys.rst:1380 msgid "" "Objects that are immortal (and thus return ``True`` upon being passed to " "this function) are not guaranteed to be immortal in future versions, and " "vice versa for mortal objects." msgstr "" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1393 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1403 +#: ../../library/sys.rst:1407 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " -"hold the legacy representation of ``sys.last_exc``, as returned " -"from :func:`exc_info` above." +"hold the legacy representation of ``sys.last_exc``, as returned from :func:" +"`exc_info` above." msgstr "" -#: ../../library/sys.rst:1409 +#: ../../library/sys.rst:1413 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1420 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1423 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1427 +#: ../../library/sys.rst:1431 msgid "" -"A list of :term:`meta path finder` objects that have " -"their :meth:`~importlib.abc.MetaPathFinder.find_spec` methods called to see " -"if one of the objects can find the module to be imported. By default, it " -"holds entries that implement Python's default import semantics. " -"The :meth:`~importlib.abc.MetaPathFinder.find_spec` method is called with at " -"least the absolute name of the module being imported. If the module to be " -"imported is contained in a package, then the parent " -"package's :attr:`~module.__path__` attribute is passed in as a second " -"argument. The method returns a :term:`module spec`, or ``None`` if the " -"module cannot be found." +"A list of :term:`meta path finder` objects that have their :meth:`~importlib." +"abc.MetaPathFinder.find_spec` methods called to see if one of the objects " +"can find the module to be imported. By default, it holds entries that " +"implement Python's default import semantics. The :meth:`~importlib.abc." +"MetaPathFinder.find_spec` method is called with at least the absolute name " +"of the module being imported. If the module to be imported is contained in a " +"package, then the parent package's :attr:`~module.__path__` attribute is " +"passed in as a second argument. The method returns a :term:`module spec`, or " +"``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1440 +#: ../../library/sys.rst:1444 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1441 +#: ../../library/sys.rst:1445 msgid "" -"The abstract base class defining the interface of finder objects " -"on :data:`meta_path`." +"The abstract base class defining the interface of finder objects on :data:" +"`meta_path`." msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1447 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1444 +#: ../../library/sys.rst:1448 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1450 +#: ../../library/sys.rst:1454 msgid "" -":term:`Module specs ` were introduced in Python 3.4, " -"by :pep:`451`." +":term:`Module specs ` were introduced in Python 3.4, by :pep:" +"`451`." msgstr "" -#: ../../library/sys.rst:1455 +#: ../../library/sys.rst:1459 msgid "" -"Removed the fallback that looked for a :meth:`!find_module` method if " -"a :data:`meta_path` entry didn't have " -"a :meth:`~importlib.abc.MetaPathFinder.find_spec` method." +"Removed the fallback that looked for a :meth:`!find_module` method if a :" +"data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." +"find_spec` method." msgstr "" -#: ../../library/sys.rst:1461 +#: ../../library/sys.rst:1465 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1811,13 +1810,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1473 +#: ../../library/sys.rst:1477 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1476 +#: ../../library/sys.rst:1480 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1825,68 +1824,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1488 +#: ../../library/sys.rst:1492 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1492 +#: ../../library/sys.rst:1496 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1496 +#: ../../library/sys.rst:1500 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1498 +#: ../../library/sys.rst:1502 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1504 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1503 +#: ../../library/sys.rst:1507 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1506 +#: ../../library/sys.rst:1510 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1512 +#: ../../library/sys.rst:1516 msgid "" -"Module :mod:`site` This describes how to use .pth files to " -"extend :data:`sys.path`." +"Module :mod:`site` This describes how to use .pth files to extend :data:`sys." +"path`." msgstr "" -#: ../../library/sys.rst:1517 +#: ../../library/sys.rst:1521 msgid "" -"A list of callables that take a path argument to try to create " -"a :term:`finder` for the path. If a finder can be created, it is to be " -"returned by the callable, else raise :exc:`ImportError`." +"A list of callables that take a path argument to try to create a :term:" +"`finder` for the path. If a finder can be created, it is to be returned by " +"the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1521 ../../library/sys.rst:1532 +#: ../../library/sys.rst:1525 ../../library/sys.rst:1536 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1526 +#: ../../library/sys.rst:1530 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1894,99 +1893,99 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1537 +#: ../../library/sys.rst:1541 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1540 +#: ../../library/sys.rst:1544 msgid "System" msgstr "系統" -#: ../../library/sys.rst:1540 +#: ../../library/sys.rst:1544 msgid "``platform`` value" msgstr "``platform`` 值" -#: ../../library/sys.rst:1542 +#: ../../library/sys.rst:1546 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1542 +#: ../../library/sys.rst:1546 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1543 +#: ../../library/sys.rst:1547 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1543 +#: ../../library/sys.rst:1547 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1544 +#: ../../library/sys.rst:1548 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1544 +#: ../../library/sys.rst:1548 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1545 +#: ../../library/sys.rst:1549 msgid "FreeBSD" msgstr "FreeBSD" -#: ../../library/sys.rst:1545 +#: ../../library/sys.rst:1549 msgid "``'freebsd'``" msgstr "``'freebsd'``" -#: ../../library/sys.rst:1546 +#: ../../library/sys.rst:1550 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1546 +#: ../../library/sys.rst:1550 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1551 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1551 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1548 +#: ../../library/sys.rst:1552 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1548 +#: ../../library/sys.rst:1552 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1549 +#: ../../library/sys.rst:1553 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1549 +#: ../../library/sys.rst:1553 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1550 +#: ../../library/sys.rst:1554 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1550 +#: ../../library/sys.rst:1554 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1555 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1555 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1554 +#: ../../library/sys.rst:1558 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1995,7 +1994,7 @@ msgid "" "therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1560 +#: ../../library/sys.rst:1564 msgid "" "if sys.platform.startswith('sunos'):\n" " # SunOS-specific code here..." @@ -2003,81 +2002,81 @@ msgstr "" "if sys.platform.startswith('sunos'):\n" " # 這裡會是 SunOS 專屬的程式碼..." -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1567 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1567 +#: ../../library/sys.rst:1571 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1571 +#: ../../library/sys.rst:1575 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1575 +#: ../../library/sys.rst:1579 msgid "" "On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore. " "It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``." msgstr "" -#: ../../library/sys.rst:1581 +#: ../../library/sys.rst:1585 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1584 +#: ../../library/sys.rst:1588 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1590 +#: ../../library/sys.rst:1594 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1593 +#: ../../library/sys.rst:1597 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " -"equal to ``\"lib64\"`` on 64-bit platforms which gives the following " -"``sys.path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" +"equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." +"path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1597 +#: ../../library/sys.rst:1601 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1599 +#: ../../library/sys.rst:1603 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1602 +#: ../../library/sys.rst:1606 msgid "" -"``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, " -"not :data:`sys.platlibdir`): Third-party modules" +"``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." +"platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1604 +#: ../../library/sys.rst:1608 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1612 +#: ../../library/sys.rst:1616 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -2086,7 +2085,7 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1620 +#: ../../library/sys.rst:1624 msgid "" "If a :ref:`virtual environment ` is in effect, this :data:`prefix` " "will point to the virtual environment. The value for the Python installation " @@ -2094,7 +2093,7 @@ msgid "" "init-virtual-environments` for more information." msgstr "" -#: ../../library/sys.rst:1644 +#: ../../library/sys.rst:1648 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -2104,25 +2103,25 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1654 +#: ../../library/sys.rst:1658 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " "enable a lazy resolving of symbols when importing a module, if called as " "``sys.setdlopenflags(0)``. To share symbols across extension modules, call " "as ``sys.setdlopenflags(os.RTLD_GLOBAL)``. Symbolic names for the flag " -"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, " -"e.g. :const:`os.RTLD_LAZY`)." +"values can be found in the :mod:`os` module (:samp:`RTLD_{xxx}` constants, e." +"g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1670 msgid "" "Set the :ref:`integer string conversion length limitation " -"` used by this interpreter. See " -"also :func:`get_int_max_str_digits`." +"` used by this interpreter. See also :func:" +"`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1678 +#: ../../library/sys.rst:1682 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -2137,14 +2136,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1690 +#: ../../library/sys.rst:1694 msgid "" -"The same tracing mechanism is used for :func:`!setprofile` " -"as :func:`settrace`. To trace calls with :func:`!setprofile` inside a " -"tracing function (e.g. in a debugger breakpoint), see :func:`call_tracing`." +"The same tracing mechanism is used for :func:`!setprofile` as :func:" +"`settrace`. To trace calls with :func:`!setprofile` inside a tracing " +"function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1694 +#: ../../library/sys.rst:1698 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2152,71 +2151,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1699 ../../library/sys.rst:1786 +#: ../../library/sys.rst:1703 ../../library/sys.rst:1790 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1701 ../../library/sys.rst:1788 +#: ../../library/sys.rst:1705 ../../library/sys.rst:1792 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1702 +#: ../../library/sys.rst:1706 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1705 ../../library/sys.rst:1803 +#: ../../library/sys.rst:1709 ../../library/sys.rst:1807 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1706 +#: ../../library/sys.rst:1710 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1710 +#: ../../library/sys.rst:1714 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1711 +#: ../../library/sys.rst:1715 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1714 +#: ../../library/sys.rst:1718 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1715 +#: ../../library/sys.rst:1719 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1721 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1718 +#: ../../library/sys.rst:1722 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1720 +#: ../../library/sys.rst:1724 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1725 +#: ../../library/sys.rst:1729 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1729 +#: ../../library/sys.rst:1733 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2224,19 +2223,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1734 +#: ../../library/sys.rst:1738 msgid "" -"If the new limit is too low at the current recursion depth, " -"a :exc:`RecursionError` exception is raised." +"If the new limit is too low at the current recursion depth, a :exc:" +"`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1737 +#: ../../library/sys.rst:1741 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1744 +#: ../../library/sys.rst:1748 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2247,16 +2246,16 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1761 +#: ../../library/sys.rst:1765 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " "debugger to support multiple threads, it must register a trace function " -"using :func:`settrace` for each thread being debugged or " -"use :func:`threading.settrace`." +"using :func:`settrace` for each thread being debugged or use :func:" +"`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1766 +#: ../../library/sys.rst:1770 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the :ref:`current stack frame `. *event* is a " @@ -2264,7 +2263,7 @@ msgid "" "``'opcode'``. *arg* depends on the event type." msgstr "" -#: ../../library/sys.rst:1771 +#: ../../library/sys.rst:1775 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2272,36 +2271,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1776 +#: ../../library/sys.rst:1780 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1779 +#: ../../library/sys.rst:1783 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1783 +#: ../../library/sys.rst:1787 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1789 +#: ../../library/sys.rst:1793 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1793 +#: ../../library/sys.rst:1797 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1794 +#: ../../library/sys.rst:1798 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2311,7 +2310,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1804 +#: ../../library/sys.rst:1808 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2319,62 +2318,62 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1809 +#: ../../library/sys.rst:1813 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1810 +#: ../../library/sys.rst:1814 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1814 +#: ../../library/sys.rst:1818 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1815 +#: ../../library/sys.rst:1819 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " "value specifies the new local trace function. Per-opcode events are not " -"emitted by default: they must be explicitly requested by " -"setting :attr:`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame " -"`." +"emitted by default: they must be explicitly requested by setting :attr:" +"`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1822 +#: ../../library/sys.rst:1826 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1825 +#: ../../library/sys.rst:1829 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " "it being set indirectly via the return value from an already installed trace " "function. This is also required for activating the trace function on the " "current frame, which :func:`settrace` doesn't do. Note that in order for " -"this to work, a global tracing function must have been installed " -"with :func:`settrace` in order to enable the runtime tracing machinery, but " -"it doesn't need to be the same tracing function (e.g. it could be a low " -"overhead tracing function that simply returns ``None`` to disable itself " -"immediately on each frame)." +"this to work, a global tracing function must have been installed with :func:" +"`settrace` in order to enable the runtime tracing machinery, but it doesn't " +"need to be the same tracing function (e.g. it could be a low overhead " +"tracing function that simply returns ``None`` to disable itself immediately " +"on each frame)." msgstr "" -#: ../../library/sys.rst:1836 +#: ../../library/sys.rst:1840 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1838 +#: ../../library/sys.rst:1842 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1842 +#: ../../library/sys.rst:1846 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2382,51 +2381,51 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1849 +#: ../../library/sys.rst:1853 msgid "" -"``'opcode'`` event type added; :attr:`~frame.f_trace_lines` " -"and :attr:`~frame.f_trace_opcodes` attributes added to frames" +"``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" +"`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1854 +#: ../../library/sys.rst:1858 msgid "" -"Accepts two optional keyword arguments which are callables that accept " -"an :term:`asynchronous generator iterator` as an argument. The *firstiter* " +"Accepts two optional keyword arguments which are callables that accept an :" +"term:`asynchronous generator iterator` as an argument. The *firstiter* " "callable will be called when an asynchronous generator is iterated for the " "first time. The *finalizer* will be called when an asynchronous generator is " "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1860 +#: ../../library/sys.rst:1864 msgid "" -"Raises an :ref:`auditing event ` " -"``sys.set_asyncgen_hooks_firstiter`` with no arguments." +"Raises an :ref:`auditing event ` ``sys." +"set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``sys.set_asyncgen_hooks_firstiter``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." +"set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1862 +#: ../../library/sys.rst:1866 msgid "" -"Raises an :ref:`auditing event ` " -"``sys.set_asyncgen_hooks_finalizer`` with no arguments." +"Raises an :ref:`auditing event ` ``sys." +"set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` " -"``sys.set_asyncgen_hooks_finalizer``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." +"set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1864 +#: ../../library/sys.rst:1868 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1867 +#: ../../library/sys.rst:1871 msgid "" "See :pep:`525` for more details, and for a reference example of a " -"*finalizer* method see the implementation of " -"``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" +"*finalizer* method see the implementation of ``asyncio.Loop." +"shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1879 +#: ../../library/sys.rst:1883 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2435,53 +2434,53 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1886 +#: ../../library/sys.rst:1890 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, set *depth* to zero." msgstr "" -#: ../../library/sys.rst:1890 +#: ../../library/sys.rst:1894 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1904 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1903 +#: ../../library/sys.rst:1907 msgid "Stack trampolines cannot be activated if the JIT is active." msgstr "" -#: ../../library/sys.rst:1911 +#: ../../library/sys.rst:1915 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1912 +#: ../../library/sys.rst:1916 msgid "https://perf.wiki.kernel.org" msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1916 +#: ../../library/sys.rst:1920 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1918 +#: ../../library/sys.rst:1922 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1926 +#: ../../library/sys.rst:1930 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1939 msgid "" "Executes *script*, a file containing Python code in the remote process with " "the given *pid*." msgstr "" -#: ../../library/sys.rst:1938 +#: ../../library/sys.rst:1942 msgid "" "This function returns immediately, and the code will be executed by the " "target process's main thread at the next available opportunity, similarly to " @@ -2491,7 +2490,7 @@ msgid "" "been overwritten." msgstr "" -#: ../../library/sys.rst:1945 +#: ../../library/sys.rst:1949 msgid "" "The remote process must be running a CPython interpreter of the same major " "and minor version as the local process. If either the local or remote " @@ -2499,15 +2498,15 @@ msgid "" "local and remote interpreters must be the same exact version." msgstr "" -#: ../../library/sys.rst:1950 ../../library/sys.rst:1952 +#: ../../library/sys.rst:1954 ../../library/sys.rst:1956 msgid "" "When the code is executed in the remote process, an :ref:`auditing event " "` ``sys.remote_exec`` is raised with the *pid* and the path to the " -"script file. This event is raised in the process that " -"called :func:`sys.remote_exec`." +"script file. This event is raised in the process that called :func:`sys." +"remote_exec`." msgstr "" -#: ../../library/sys.rst:1957 ../../library/sys.rst:1959 +#: ../../library/sys.rst:1961 ../../library/sys.rst:1963 msgid "" "When the script is executed in the remote process, an :ref:`auditing event " "` ``cpython.remote_debugger_script`` is raised with the path in " @@ -2515,75 +2514,74 @@ msgid "" "that called :func:`sys.remote_exec`." msgstr "" -#: ../../library/sys.rst:1972 +#: ../../library/sys.rst:1976 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1976 +#: ../../library/sys.rst:1980 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1979 +#: ../../library/sys.rst:1983 msgid "" -"See also :func:`sys.getfilesystemencoding` " -"and :func:`sys.getfilesystemencodeerrors`." +"See also :func:`sys.getfilesystemencoding` and :func:`sys." +"getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1985 +#: ../../library/sys.rst:1989 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1989 +#: ../../library/sys.rst:1993 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1992 +#: ../../library/sys.rst:1996 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1999 +#: ../../library/sys.rst:2003 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:2002 +#: ../../library/sys.rst:2006 msgid "" -"``stdin`` is used for all interactive input (including calls " -"to :func:`input`);" +"``stdin`` is used for all interactive input (including calls to :func:" +"`input`);" msgstr "" -#: ../../library/sys.rst:2004 +#: ../../library/sys.rst:2008 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:2006 +#: ../../library/sys.rst:2010 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:2008 +#: ../../library/sys.rst:2012 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:2012 +#: ../../library/sys.rst:2016 msgid "" -"The encoding and error handling are is initialized " -"from :c:member:`PyConfig.stdio_encoding` " -"and :c:member:`PyConfig.stdio_errors`." +"The encoding and error handling are is initialized from :c:member:`PyConfig." +"stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:2015 +#: ../../library/sys.rst:2019 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2594,45 +2592,44 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:2024 +#: ../../library/sys.rst:2028 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:2029 +#: ../../library/sys.rst:2033 msgid "" -"Under all platforms, you can override the character encoding by setting " -"the :envvar:`PYTHONIOENCODING` environment variable before starting Python " -"or by using the new :option:`-X` ``utf8`` command line option " -"and :envvar:`PYTHONUTF8` environment variable. However, for the Windows " -"console, this only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also " -"set." +"Under all platforms, you can override the character encoding by setting the :" +"envvar:`PYTHONIOENCODING` environment variable before starting Python or by " +"using the new :option:`-X` ``utf8`` command line option and :envvar:" +"`PYTHONUTF8` environment variable. However, for the Windows console, this " +"only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:2036 +#: ../../library/sys.rst:2040 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" "buffered in both cases. You can make both streams unbuffered by passing " -"the :option:`-u` command-line option or setting " -"the :envvar:`PYTHONUNBUFFERED` environment variable." +"the :option:`-u` command-line option or setting the :envvar:" +"`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:2042 +#: ../../library/sys.rst:2046 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:2048 +#: ../../library/sys.rst:2052 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:2052 +#: ../../library/sys.rst:2056 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2640,7 +2637,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:2062 +#: ../../library/sys.rst:2066 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2648,7 +2645,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:2067 +#: ../../library/sys.rst:2071 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2656,7 +2653,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:2073 +#: ../../library/sys.rst:2077 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2664,12 +2661,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:2081 +#: ../../library/sys.rst:2085 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:2083 +#: ../../library/sys.rst:2087 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2677,7 +2674,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:2088 +#: ../../library/sys.rst:2092 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2685,60 +2682,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:2093 +#: ../../library/sys.rst:2097 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:2100 +#: ../../library/sys.rst:2104 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:2105 +#: ../../library/sys.rst:2109 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:2107 +#: ../../library/sys.rst:2111 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:2108 +#: ../../library/sys.rst:2112 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:2109 +#: ../../library/sys.rst:2113 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:2111 +#: ../../library/sys.rst:2115 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:2115 +#: ../../library/sys.rst:2119 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:2117 +#: ../../library/sys.rst:2121 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:2118 +#: ../../library/sys.rst:2122 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:2119 +#: ../../library/sys.rst:2123 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:2123 +#: ../../library/sys.rst:2127 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:2131 +#: ../../library/sys.rst:2135 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2747,73 +2744,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:2139 +#: ../../library/sys.rst:2143 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:2141 +#: ../../library/sys.rst:2145 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:2145 +#: ../../library/sys.rst:2149 msgid "The *unraisable* argument has the following attributes:" msgstr "*unraisable* 引數具有以下屬性:" -#: ../../library/sys.rst:2147 +#: ../../library/sys.rst:2151 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:2148 +#: ../../library/sys.rst:2152 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:2149 +#: ../../library/sys.rst:2153 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:2150 +#: ../../library/sys.rst:2154 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:2151 +#: ../../library/sys.rst:2155 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:2153 +#: ../../library/sys.rst:2157 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " -"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message " -"if :attr:`!err_msg` is ``None``." +"``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" +"attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:2157 +#: ../../library/sys.rst:2161 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:2162 +#: ../../library/sys.rst:2166 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:2166 +#: ../../library/sys.rst:2170 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:2170 +#: ../../library/sys.rst:2174 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:2174 ../../library/sys.rst:2176 +#: ../../library/sys.rst:2178 ../../library/sys.rst:2180 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2821,7 +2818,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:2185 +#: ../../library/sys.rst:2189 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2830,41 +2827,41 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:2194 +#: ../../library/sys.rst:2198 msgid "" "The C API version, equivalent to the C macro :c:macro:`PYTHON_API_VERSION`. " "Defined for backwards compatibility." msgstr "" -#: ../../library/sys.rst:2197 +#: ../../library/sys.rst:2201 msgid "" "Currently, this constant is not updated in new Python versions, and is not " "useful for versioning. This may change in the future." msgstr "" -#: ../../library/sys.rst:2203 +#: ../../library/sys.rst:2207 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " "*releaselevel* are integers; the release level is ``'alpha'``, ``'beta'``, " "``'candidate'``, or ``'final'``. The ``version_info`` value corresponding " "to the Python version 2.0 is ``(2, 0, 0, 'final', 0)``. The components can " -"also be accessed by name, so ``sys.version_info[0]`` is equivalent to " -"``sys.version_info.major`` and so on." +"also be accessed by name, so ``sys.version_info[0]`` is equivalent to ``sys." +"version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:2211 +#: ../../library/sys.rst:2215 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2216 +#: ../../library/sys.rst:2220 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2223 +#: ../../library/sys.rst:2227 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2873,20 +2870,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2235 +#: ../../library/sys.rst:2239 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2241 +#: ../../library/sys.rst:2245 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2245 +#: ../../library/sys.rst:2249 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2906,18 +2903,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2257 +#: ../../library/sys.rst:2261 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2265 +#: ../../library/sys.rst:2269 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2266 +#: ../../library/sys.rst:2270 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2938,50 +2935,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:990 ../../library/sys.rst:1674 +#: ../../library/sys.rst:990 ../../library/sys.rst:1678 msgid "profile function" msgstr "" -#: ../../library/sys.rst:990 ../../library/sys.rst:1674 +#: ../../library/sys.rst:990 ../../library/sys.rst:1678 msgid "profiler" msgstr "" -#: ../../library/sys.rst:999 ../../library/sys.rst:1757 +#: ../../library/sys.rst:999 ../../library/sys.rst:1761 msgid "trace function" msgstr "" -#: ../../library/sys.rst:999 ../../library/sys.rst:1757 +#: ../../library/sys.rst:999 ../../library/sys.rst:1761 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1490 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1490 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1490 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1642 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1642 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1642 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1642 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1642 msgid "..." msgstr "..." diff --git a/library/time.po b/library/time.po index 0c9428095c..45c42ebc42 100644 --- a/library/time.po +++ b/library/time.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: 2025-11-09 00:17+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -613,14 +613,15 @@ msgid "Windows implementation" msgstr "Windows 實作" #: ../../library/time.rst:396 +#, fuzzy msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " "threads ready to run, the function returns immediately, and the thread " -"continues execution. On Windows 8.1 and newer the implementation uses a " -"`high-resolution timer `_ which provides resolution of 100 " -"nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." +"continues execution. On Windows 10 and newer the implementation uses a " +"`high-resolution timer `_ which provides resolution of " +"100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." msgstr "" "在 Windows 上,如果 *secs* 為零,則執行緒將其剩餘的時間片段讓給任何準備運行的" "其他執行緒。如果沒有其他執行緒準備運行,該函式將立即回傳,而執行緒會繼續執"