diff --git a/library/bdb.po b/library/bdb.po index 5fb7e78d02c..bd799b37103 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,79 +60,128 @@ msgstr "" #: ../../library/bdb.rst:33 msgid "" -"When creating a breakpoint, its associated filename should be in canonical " -"form. If a *funcname* is defined, a breakpoint hit will be counted when the " -"first line of that function is executed. A conditional breakpoint always " -"counts a hit." +"When creating a breakpoint, its associated :attr:`file name ` should " +"be in canonical form. If a :attr:`funcname` is defined, a breakpoint :attr:" +"`hit ` will be counted when the first line of that function is " +"executed. A :attr:`conditional ` breakpoint always counts a :attr:" +"`hit `." msgstr "" -#: ../../library/bdb.rst:38 +#: ../../library/bdb.rst:39 msgid ":class:`Breakpoint` instances have the following methods:" msgstr "" -#: ../../library/bdb.rst:42 +#: ../../library/bdb.rst:43 msgid "" "Delete the breakpoint from the list associated to a file/line. If it is the " "last breakpoint in that position, it also deletes the entry for the file/" "line." msgstr "" -#: ../../library/bdb.rst:49 +#: ../../library/bdb.rst:50 msgid "Mark the breakpoint as enabled." msgstr "" -#: ../../library/bdb.rst:54 +#: ../../library/bdb.rst:55 msgid "Mark the breakpoint as disabled." msgstr "" -#: ../../library/bdb.rst:59 +#: ../../library/bdb.rst:60 msgid "" "Return a string with all the information about the breakpoint, nicely " "formatted:" msgstr "" -#: ../../library/bdb.rst:62 -msgid "The breakpoint number." -msgstr "" - #: ../../library/bdb.rst:63 -msgid "If it is temporary or not." +msgid "Breakpoint number." msgstr "" #: ../../library/bdb.rst:64 -msgid "Its file,line position." +msgid "Temporary status (del or keep)." msgstr "" #: ../../library/bdb.rst:65 -msgid "The condition that causes a break." +msgid "File/line position." msgstr "" #: ../../library/bdb.rst:66 -msgid "If it must be ignored the next N times." +msgid "Break condition." msgstr "" #: ../../library/bdb.rst:67 -msgid "The breakpoint hit count." +msgid "Number of times to ignore." msgstr "" -#: ../../library/bdb.rst:73 +#: ../../library/bdb.rst:68 +msgid "Number of times hit." +msgstr "" + +#: ../../library/bdb.rst:74 msgid "" "Print the output of :meth:`bpformat` to the file *out*, or if it is " "``None``, to standard output." msgstr "" -#: ../../library/bdb.rst:79 -msgid "The :class:`Bdb` class acts as a generic Python debugger base class." +#: ../../library/bdb.rst:77 +msgid ":class:`Breakpoint` instances have the following attributes:" msgstr "" #: ../../library/bdb.rst:81 +msgid "File name of the :class:`Breakpoint`." +msgstr "" + +#: ../../library/bdb.rst:85 +msgid "Line number of the :class:`Breakpoint` within :attr:`file`." +msgstr "" + +#: ../../library/bdb.rst:89 +msgid "True if a :class:`Breakpoint` at (file, line) is temporary." +msgstr "" + +#: ../../library/bdb.rst:93 +msgid "Condition for evaluating a :class:`Breakpoint` at (file, line)." +msgstr "" + +#: ../../library/bdb.rst:97 +msgid "" +"Function name that defines whether a :class:`Breakpoint` is hit upon " +"entering the function." +msgstr "" + +#: ../../library/bdb.rst:102 +msgid "True if :class:`Breakpoint` is enabled." +msgstr "" + +#: ../../library/bdb.rst:106 +msgid "Numeric index for a single instance of a :class:`Breakpoint`." +msgstr "" + +#: ../../library/bdb.rst:110 +msgid "" +"Dictionary of :class:`Breakpoint` instances indexed by (:attr:`file`, :attr:" +"`line`) tuples." +msgstr "" + +#: ../../library/bdb.rst:115 +msgid "Number of times to ignore a :class:`Breakpoint`." +msgstr "" + +#: ../../library/bdb.rst:119 +msgid "Count of the number of times a :class:`Breakpoint` has been hit." +msgstr "" + +#: ../../library/bdb.rst:123 +msgid "The :class:`Bdb` class acts as a generic Python debugger base class." +msgstr "" + +#: ../../library/bdb.rst:125 msgid "" "This class takes care of the details of the trace facility; a derived class " "should implement user interaction. The standard debugger class (:class:`pdb." "Pdb`) is an example." msgstr "" -#: ../../library/bdb.rst:85 +#: ../../library/bdb.rst:129 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -141,89 +190,94 @@ msgid "" "globals." msgstr "" -#: ../../library/bdb.rst:91 +#: ../../library/bdb.rst:135 msgid "The *skip* argument." msgstr "*skip* 引數。" -#: ../../library/bdb.rst:94 +#: ../../library/bdb.rst:138 msgid "" "The following methods of :class:`Bdb` normally don't need to be overridden." msgstr "" -#: ../../library/bdb.rst:98 +#: ../../library/bdb.rst:142 +msgid "Return canonical form of *filename*." +msgstr "" + +#: ../../library/bdb.rst:144 msgid "" -"Auxiliary method for getting a filename in a canonical form, that is, as a " -"case-normalized (on case-insensitive filesystems) absolute path, stripped of " -"surrounding angle brackets." +"For real file names, the canonical form is an operating-system-dependent, :" +"func:`case-normalized ` :func:`absolute path `. A *filename* with angle brackets, such as `\"\"` generated " +"in interactive mode, is returned unchanged." msgstr "" -#: ../../library/bdb.rst:104 +#: ../../library/bdb.rst:151 msgid "" "Set the :attr:`botframe`, :attr:`stopframe`, :attr:`returnframe` and :attr:" "`quitting` attributes with values ready to start debugging." msgstr "" -#: ../../library/bdb.rst:109 +#: ../../library/bdb.rst:156 msgid "" "This function is installed as the trace function of debugged frames. Its " "return value is the new trace function (in most cases, that is, itself)." msgstr "" -#: ../../library/bdb.rst:112 +#: ../../library/bdb.rst:159 msgid "" "The default implementation decides how to dispatch a frame, depending on the " "type of event (passed as a string) that is about to be executed. *event* can " "be one of the following:" msgstr "" -#: ../../library/bdb.rst:116 +#: ../../library/bdb.rst:163 msgid "``\"line\"``: A new line of code is going to be executed." msgstr "" -#: ../../library/bdb.rst:117 +#: ../../library/bdb.rst:164 msgid "" "``\"call\"``: A function is about to be called, or another code block " "entered." msgstr "" -#: ../../library/bdb.rst:119 +#: ../../library/bdb.rst:166 msgid "``\"return\"``: A function or other code block is about to return." msgstr "" -#: ../../library/bdb.rst:120 +#: ../../library/bdb.rst:167 msgid "``\"exception\"``: An exception has occurred." msgstr "" -#: ../../library/bdb.rst:121 +#: ../../library/bdb.rst:168 msgid "``\"c_call\"``: A C function is about to be called." msgstr "" -#: ../../library/bdb.rst:122 +#: ../../library/bdb.rst:169 msgid "``\"c_return\"``: A C function has returned." msgstr "" -#: ../../library/bdb.rst:123 +#: ../../library/bdb.rst:170 msgid "``\"c_exception\"``: A C function has raised an exception." msgstr "" -#: ../../library/bdb.rst:125 +#: ../../library/bdb.rst:172 msgid "" "For the Python events, specialized functions (see below) are called. For " "the C events, no action is taken." msgstr "" -#: ../../library/bdb.rst:128 +#: ../../library/bdb.rst:175 msgid "The *arg* parameter depends on the previous event." msgstr "" -#: ../../library/bdb.rst:130 +#: ../../library/bdb.rst:177 msgid "" "See the documentation for :func:`sys.settrace` for more information on the " "trace function. For more information on code and frame objects, refer to :" "ref:`types`." msgstr "" -#: ../../library/bdb.rst:136 +#: ../../library/bdb.rst:183 msgid "" "If the debugger should stop on the current line, invoke the :meth:" "`user_line` method (which should be overridden in subclasses). Raise a :exc:" @@ -232,7 +286,7 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:144 +#: ../../library/bdb.rst:191 msgid "" "If the debugger should stop on this function call, invoke the :meth:" "`user_call` method (which should be overridden in subclasses). Raise a :exc:" @@ -241,7 +295,7 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:152 +#: ../../library/bdb.rst:199 msgid "" "If the debugger should stop on this function return, invoke the :meth:" "`user_return` method (which should be overridden in subclasses). Raise a :" @@ -250,7 +304,7 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:160 +#: ../../library/bdb.rst:207 msgid "" "If the debugger should stop at this exception, invokes the :meth:" "`user_exception` method (which should be overridden in subclasses). Raise a :" @@ -259,150 +313,152 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: ../../library/bdb.rst:166 +#: ../../library/bdb.rst:213 msgid "" "Normally derived classes don't override the following methods, but they may " "if they want to redefine the definition of stopping and breakpoints." msgstr "" -#: ../../library/bdb.rst:171 -msgid "" -"This method checks if the *frame* is somewhere below :attr:`botframe` in the " -"call stack. :attr:`botframe` is the frame in which debugging started." +#: ../../library/bdb.rst:218 +msgid "Return True if *module_name* matches any skip pattern." msgstr "" -#: ../../library/bdb.rst:176 -msgid "" -"This method checks if there is a breakpoint in the filename and line " -"belonging to *frame* or, at least, in the current function. If the " -"breakpoint is a temporary one, this method deletes it." +#: ../../library/bdb.rst:222 +msgid "Return True if *frame* is below the starting frame in the stack." msgstr "" -#: ../../library/bdb.rst:182 +#: ../../library/bdb.rst:226 +msgid "Return True if there is an effective breakpoint for this line." +msgstr "" + +#: ../../library/bdb.rst:228 msgid "" -"This method checks if there is a breakpoint in the filename of the current " -"frame." +"Check whether a line or function breakpoint exists and is in effect. Delete " +"temporary breakpoints based on information from :func:`effective`." +msgstr "" + +#: ../../library/bdb.rst:233 +msgid "Return True if any breakpoint exists for *frame*'s filename." msgstr "" -#: ../../library/bdb.rst:185 +#: ../../library/bdb.rst:235 msgid "" "Derived classes should override these methods to gain control over debugger " "operation." msgstr "" -#: ../../library/bdb.rst:190 +#: ../../library/bdb.rst:240 msgid "" -"This method is called from :meth:`dispatch_call` when there is the " -"possibility that a break might be necessary anywhere inside the called " +"Called from :meth:`dispatch_call` if a break might stop inside the called " "function." msgstr "" -#: ../../library/bdb.rst:196 +#: ../../library/bdb.rst:245 msgid "" -"This method is called from :meth:`dispatch_line` when either :meth:" -"`stop_here` or :meth:`break_here` yields ``True``." +"Called from :meth:`dispatch_line` when either :meth:`stop_here` or :meth:" +"`break_here` returns ``True``." msgstr "" -#: ../../library/bdb.rst:201 +#: ../../library/bdb.rst:250 msgid "" -"This method is called from :meth:`dispatch_return` when :meth:`stop_here` " -"yields ``True``." +"Called from :meth:`dispatch_return` when :meth:`stop_here` returns ``True``." msgstr "" -#: ../../library/bdb.rst:206 +#: ../../library/bdb.rst:254 msgid "" -"This method is called from :meth:`dispatch_exception` when :meth:`stop_here` " -"yields ``True``." +"Called from :meth:`dispatch_exception` when :meth:`stop_here` returns " +"``True``." msgstr "" -#: ../../library/bdb.rst:211 +#: ../../library/bdb.rst:259 msgid "Handle how a breakpoint must be removed when it is a temporary one." msgstr "" -#: ../../library/bdb.rst:213 +#: ../../library/bdb.rst:261 msgid "This method must be implemented by derived classes." msgstr "" -#: ../../library/bdb.rst:216 +#: ../../library/bdb.rst:264 msgid "" "Derived classes and clients can call the following methods to affect the " "stepping state." msgstr "" -#: ../../library/bdb.rst:221 +#: ../../library/bdb.rst:269 msgid "Stop after one line of code." msgstr "" -#: ../../library/bdb.rst:225 +#: ../../library/bdb.rst:273 msgid "Stop on the next line in or below the given frame." msgstr "" -#: ../../library/bdb.rst:229 +#: ../../library/bdb.rst:277 msgid "Stop when returning from the given frame." msgstr "" -#: ../../library/bdb.rst:233 +#: ../../library/bdb.rst:281 msgid "" -"Stop when the line with the line no greater than the current one is reached " +"Stop when the line with the *lineno* greater than the current one is reached " "or when returning from current frame." msgstr "" -#: ../../library/bdb.rst:238 +#: ../../library/bdb.rst:286 msgid "" "Start debugging from *frame*. If *frame* is not specified, debugging starts " "from caller's frame." msgstr "" -#: ../../library/bdb.rst:243 +#: ../../library/bdb.rst:291 msgid "" "Stop only at breakpoints or when finished. If there are no breakpoints, set " "the system trace function to ``None``." msgstr "" -#: ../../library/bdb.rst:248 +#: ../../library/bdb.rst:296 msgid "" "Set the :attr:`quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`dispatch_\\*` methods." msgstr "" -#: ../../library/bdb.rst:252 +#: ../../library/bdb.rst:300 msgid "" "Derived classes and clients can call the following methods to manipulate " "breakpoints. These methods return a string containing an error message if " "something went wrong, or ``None`` if all is well." msgstr "" -#: ../../library/bdb.rst:258 +#: ../../library/bdb.rst:306 msgid "" "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " "passed as argument, return an error message. The *filename* should be in " "canonical form, as described in the :meth:`canonic` method." msgstr "" -#: ../../library/bdb.rst:264 +#: ../../library/bdb.rst:312 msgid "" -"Delete the breakpoints in *filename* and *lineno*. If none were set, an " -"error message is returned." +"Delete the breakpoints in *filename* and *lineno*. If none were set, return " +"an error message." msgstr "" -#: ../../library/bdb.rst:269 +#: ../../library/bdb.rst:317 msgid "" "Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." "bpbynumber`. If *arg* is not numeric or out of range, return an error " "message." msgstr "" -#: ../../library/bdb.rst:275 +#: ../../library/bdb.rst:323 msgid "" -"Delete all breakpoints in *filename*. If none were set, an error message is " -"returned." +"Delete all breakpoints in *filename*. If none were set, return an error " +"message." msgstr "" -#: ../../library/bdb.rst:280 -msgid "Delete all existing breakpoints." +#: ../../library/bdb.rst:328 +msgid "" +"Delete all existing breakpoints. If none were set, return an error message." msgstr "" -#: ../../library/bdb.rst:284 +#: ../../library/bdb.rst:333 msgid "" "Return a breakpoint specified by the given number. If *arg* is a string, it " "will be converted to a number. If *arg* is a non-numeric string, if the " @@ -410,114 +466,134 @@ msgid "" "raised." msgstr "" -#: ../../library/bdb.rst:293 -msgid "Check if there is a breakpoint for *lineno* of *filename*." +#: ../../library/bdb.rst:342 +msgid "Return True if there is a breakpoint for *lineno* in *filename*." msgstr "" -#: ../../library/bdb.rst:297 +#: ../../library/bdb.rst:346 msgid "" "Return all breakpoints for *lineno* in *filename*, or an empty list if none " "are set." msgstr "" -#: ../../library/bdb.rst:302 +#: ../../library/bdb.rst:351 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" -#: ../../library/bdb.rst:306 +#: ../../library/bdb.rst:355 msgid "Return all breakpoints that are set." msgstr "" -#: ../../library/bdb.rst:309 +#: ../../library/bdb.rst:358 msgid "" "Derived classes and clients can call the following methods to get a data " "structure representing a stack trace." msgstr "" -#: ../../library/bdb.rst:314 +#: ../../library/bdb.rst:363 +msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." +msgstr "" + +#: ../../library/bdb.rst:365 msgid "" -"Get a list of records for a frame and all higher (calling) and lower frames, " -"and the size of the higher part." +"The most recently called frame is last in the list. The size is the number " +"of frames below the frame where the debugger was invoked." msgstr "" -#: ../../library/bdb.rst:319 +#: ../../library/bdb.rst:370 msgid "" -"Return a string with information about a stack entry, identified by a " -"``(frame, lineno)`` tuple:" +"Return a string with information about a stack entry, which is a ``(frame, " +"lineno)`` tuple. The return string contains:" msgstr "" -#: ../../library/bdb.rst:322 -msgid "The canonical form of the filename which contains the frame." +#: ../../library/bdb.rst:373 +msgid "The canonical filename which contains the frame." msgstr "" -#: ../../library/bdb.rst:323 -msgid "The function name, or ``\"\"``." +#: ../../library/bdb.rst:374 +msgid "The function name or ``\"\"``." msgstr "" -#: ../../library/bdb.rst:324 +#: ../../library/bdb.rst:375 msgid "The input arguments." msgstr "" -#: ../../library/bdb.rst:325 +#: ../../library/bdb.rst:376 msgid "The return value." msgstr "" -#: ../../library/bdb.rst:326 +#: ../../library/bdb.rst:377 msgid "The line of code (if it exists)." msgstr "" -#: ../../library/bdb.rst:329 +#: ../../library/bdb.rst:380 msgid "" "The following two methods can be called by clients to use a debugger to " "debug a :term:`statement`, given as a string." msgstr "" -#: ../../library/bdb.rst:334 +#: ../../library/bdb.rst:385 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -#: ../../library/bdb.rst:339 +#: ../../library/bdb.rst:390 msgid "" "Debug an expression executed via the :func:`eval` function. *globals* and " "*locals* have the same meaning as in :meth:`run`." msgstr "" -#: ../../library/bdb.rst:344 +#: ../../library/bdb.rst:395 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" -#: ../../library/bdb.rst:348 +#: ../../library/bdb.rst:399 msgid "Debug a single function call, and return its result." msgstr "" -#: ../../library/bdb.rst:351 +#: ../../library/bdb.rst:402 msgid "Finally, the module defines the following functions:" msgstr "" -#: ../../library/bdb.rst:355 +#: ../../library/bdb.rst:406 msgid "" -"Check whether we should break here, depending on the way the breakpoint *b* " -"was set." +"Return True if we should break here, depending on the way the :class:" +"`Breakpoint` *b* was set." msgstr "" -#: ../../library/bdb.rst:358 +#: ../../library/bdb.rst:409 msgid "" -"If it was set via line number, it checks if ``b.line`` is the same as the " -"one in the frame also passed as argument. If the breakpoint was set via " -"function name, we have to check we are in the right frame (the right " -"function) and if we are in its first executable line." +"If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" +"attr:`function name `, we have to check we are in " +"the right *frame* (the right function) and if we are on its first executable " +"line." msgstr "" -#: ../../library/bdb.rst:365 +#: ../../library/bdb.rst:418 msgid "" -"Determine if there is an effective (active) breakpoint at this line of code. " -"Return a tuple of the breakpoint and a boolean that indicates if it is ok to " -"delete a temporary breakpoint. Return ``(None, None)`` if there is no " -"matching breakpoint." +"Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " +"the breakpoint to act upon." +msgstr "" + +#: ../../library/bdb.rst:421 +msgid "" +"The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line `) (which must exist) that is :attr:`enabled `, for which :func:`checkfuncname` is True, and that has neither a " +"False :attr:`condition ` nor positive :attr:`ignore " +"` count. The *flag*, meaning that a temporary " +"breakpoint should be deleted, is False only when the :attr:`cond ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." +msgstr "" + +#: ../../library/bdb.rst:432 +msgid "If no such entry exists, then (None, None) is returned." msgstr "" -#: ../../library/bdb.rst:372 +#: ../../library/bdb.rst:437 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" diff --git a/library/functions.po b/library/functions.po index 2045a69219a..6fb7e10bf75 100644 --- a/library/functions.po +++ b/library/functions.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-27 00:16+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2022-05-22 02:44+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -483,7 +483,7 @@ msgid "" msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" #: ../../library/functions.rst:139 ../../library/functions.rst:806 -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1110 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -1609,7 +1609,17 @@ msgstr "" msgid "Falls back to :meth:`__index__` if :meth:`__int__` is not defined." msgstr "" -#: ../../library/functions.rst:899 +#: ../../library/functions.rst:896 +msgid "" +":class:`int` string inputs and string representations can be limited to help " +"avoid denial of service attacks. A :exc:`ValueError` is raised when the " +"limit is exceeded while converting a string *x* to an :class:`int` or when " +"converting an :class:`int` into a string would exceed the limit. See the :" +"ref:`integer string conversion length limitation ` " +"documentation." +msgstr "" + +#: ../../library/functions.rst:907 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1647,7 +1657,7 @@ msgstr "" "*class* 是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會" "觸發 :exc:`TypeError`。" -#: ../../library/functions.rst:929 +#: ../../library/functions.rst:937 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1670,18 +1680,18 @@ msgstr "" "帶引數地呼叫 *object*\\ ;如果回傳的結果是 *sentinel* 則觸發 :exc:" "`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:942 +#: ../../library/functions.rst:950 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:944 +#: ../../library/functions.rst:952 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " "file until the end of file is reached::" msgstr "" -#: ../../library/functions.rst:956 +#: ../../library/functions.rst:964 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -1690,13 +1700,13 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:962 +#: ../../library/functions.rst:970 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." msgstr "" -#: ../../library/functions.rst:970 +#: ../../library/functions.rst:978 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -1704,7 +1714,7 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:976 +#: ../../library/functions.rst:984 msgid "" "Update and return a dictionary representing the current local symbol table. " "Free variables are returned by :func:`locals` when it is called in function " @@ -1715,7 +1725,7 @@ msgstr "" "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,\\ :func:" "`locals` 和 :func:`globals` 是相同的 dictionary。" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:990 msgid "" "The contents of this dictionary should not be modified; changes may not " "affect the values of local and free variables used by the interpreter." @@ -1723,7 +1733,7 @@ msgstr "" "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自由" "變數的值。" -#: ../../library/functions.rst:987 +#: ../../library/functions.rst:995 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterable* arguments are passed, " @@ -1738,13 +1748,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經是 tuple 的引數,請參" "閱 :func:`itertools.starmap`\\。" -#: ../../library/functions.rst:998 +#: ../../library/functions.rst:1006 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個及以上引數中最大的。" -#: ../../library/functions.rst:1001 +#: ../../library/functions.rst:1009 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -1753,7 +1763,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1006 ../../library/functions.rst:1043 +#: ../../library/functions.rst:1014 ../../library/functions.rst:1051 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -1765,7 +1775,7 @@ msgstr "" "式,如同 :meth:`list.sort` 使用方式。*default* 引數是當 iterable 為空時回傳的" "值。如果 iterable 為空,並且沒有提供 *default*,則會觸發 :exc:`ValueError`。" -#: ../../library/functions.rst:1012 +#: ../../library/functions.rst:1020 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1776,15 +1786,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1017 ../../library/functions.rst:1054 +#: ../../library/functions.rst:1025 ../../library/functions.rst:1062 msgid "The *default* keyword-only argument." msgstr "*default* 僅限關鍵字引數。" -#: ../../library/functions.rst:1020 ../../library/functions.rst:1057 +#: ../../library/functions.rst:1028 ../../library/functions.rst:1065 msgid "The *key* can be ``None``." msgstr "" -#: ../../library/functions.rst:1028 +#: ../../library/functions.rst:1036 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -1792,13 +1802,13 @@ msgstr "" "回傳由給定的引數建立之 \"memory view\" 物件。有關詳細資訊,請參閱 :ref:" "`typememoryview`。" -#: ../../library/functions.rst:1035 +#: ../../library/functions.rst:1043 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個及以上引數中最小的。" -#: ../../library/functions.rst:1038 +#: ../../library/functions.rst:1046 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -1807,7 +1817,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個或以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1049 +#: ../../library/functions.rst:1057 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -1818,7 +1828,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1063 +#: ../../library/functions.rst:1071 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -1828,7 +1838,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則觸發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1070 +#: ../../library/functions.rst:1078 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -1837,7 +1847,7 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1076 +#: ../../library/functions.rst:1084 msgid "" ":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " "assign arbitrary attributes to an instance of the :class:`object` class." @@ -1845,7 +1855,7 @@ msgstr "" "由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" "給 :class:`object` class 的實例。" -#: ../../library/functions.rst:1082 +#: ../../library/functions.rst:1090 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -1856,7 +1866,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1092 +#: ../../library/functions.rst:1100 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -1864,7 +1874,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1109 +#: ../../library/functions.rst:1117 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -1873,7 +1883,7 @@ msgstr "" "開啟 *file* 並回傳對應的 :term:`file object`。如果該檔案不能開啟,則觸發 :" "exc:`OSError`。關於使用此函式的更多方法請參閱\\ :ref:`tut-files`。" -#: ../../library/functions.rst:1113 +#: ../../library/functions.rst:1121 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -1886,7 +1896,7 @@ msgstr "" "果有提供檔案描述器,它會隨著回傳的 I/O 物件關閉而關閉,除非 *closefd* 被設為 " "``False``。)" -#: ../../library/functions.rst:1119 +#: ../../library/functions.rst:1127 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -1907,71 +1917,71 @@ msgstr "" "getpreferredencoding(False)`` 來獲取當前的本地編碼。(要讀取和寫入原始 " "bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1136 +#: ../../library/functions.rst:1144 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1136 +#: ../../library/functions.rst:1144 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1138 +#: ../../library/functions.rst:1146 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1138 +#: ../../library/functions.rst:1146 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1139 +#: ../../library/functions.rst:1147 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1139 +#: ../../library/functions.rst:1147 msgid "open for writing, truncating the file first" msgstr "" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1148 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1148 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性創建,如果文件已存在則會失敗" -#: ../../library/functions.rst:1141 +#: ../../library/functions.rst:1149 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1141 +#: ../../library/functions.rst:1149 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果文件存在則在末尾追加寫入內容" -#: ../../library/functions.rst:1142 +#: ../../library/functions.rst:1150 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1142 +#: ../../library/functions.rst:1150 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1143 +#: ../../library/functions.rst:1151 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1143 +#: ../../library/functions.rst:1151 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:1152 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:1152 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1147 +#: ../../library/functions.rst:1155 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -1980,7 +1990,7 @@ msgstr "" "預設的模式是 ``'r'``\\ (開啟並讀取文字,同 ``'rt'``)。對於二進位制寫入," "``'w+b'`` 模式開啟並把檔案內容變成 0 bytes,``'r+b'`` 則不會捨棄原始內容。" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1159 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -1991,7 +2001,7 @@ msgid "" "specified *encoding* if given." msgstr "" -#: ../../library/functions.rst:1159 +#: ../../library/functions.rst:1167 msgid "" "There is an additional mode character permitted, ``'U'``, which no longer " "has any effect, and is considered deprecated. It previously enabled :term:" @@ -2000,14 +2010,14 @@ msgid "" "parameter>` parameter for further details." msgstr "" -#: ../../library/functions.rst:1167 +#: ../../library/functions.rst:1175 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " "platform-independent." msgstr "" -#: ../../library/functions.rst:1171 +#: ../../library/functions.rst:1179 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2020,7 +2030,7 @@ msgid "" "given, the default buffering policy works as follows:" msgstr "" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1189 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2028,14 +2038,14 @@ msgid "" "the buffer will typically be 4096 or 8192 bytes long." msgstr "" -#: ../../library/functions.rst:1186 +#: ../../library/functions.rst:1194 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " "described above for binary files." msgstr "" -#: ../../library/functions.rst:1190 +#: ../../library/functions.rst:1198 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2044,7 +2054,7 @@ msgid "" "module for the list of supported encodings." msgstr "" -#: ../../library/functions.rst:1197 +#: ../../library/functions.rst:1205 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2053,25 +2063,25 @@ msgid "" "register_error` is also valid. The standard names include:" msgstr "" -#: ../../library/functions.rst:1205 +#: ../../library/functions.rst:1213 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." msgstr "" -#: ../../library/functions.rst:1209 +#: ../../library/functions.rst:1217 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "" -#: ../../library/functions.rst:1212 +#: ../../library/functions.rst:1220 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" -#: ../../library/functions.rst:1215 +#: ../../library/functions.rst:1223 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2080,33 +2090,33 @@ msgid "" "an unknown encoding." msgstr "" -#: ../../library/functions.rst:1222 +#: ../../library/functions.rst:1230 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " "character reference ``&#nnn;``." msgstr "" -#: ../../library/functions.rst:1226 +#: ../../library/functions.rst:1234 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." msgstr "" -#: ../../library/functions.rst:1229 +#: ../../library/functions.rst:1237 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." msgstr "" -#: ../../library/functions.rst:1237 +#: ../../library/functions.rst:1245 msgid "" "*newline* controls how :term:`universal newlines` mode works (it only " "applies to text mode). It can be ``None``, ``''``, ``'\\n'``, ``'\\r'``, " "and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/functions.rst:1241 +#: ../../library/functions.rst:1249 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2117,7 +2127,7 @@ msgid "" "given string, and the line ending is returned to the caller untranslated." msgstr "" -#: ../../library/functions.rst:1249 +#: ../../library/functions.rst:1257 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2126,7 +2136,7 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/functions.rst:1255 +#: ../../library/functions.rst:1263 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2134,7 +2144,7 @@ msgid "" "otherwise, an error will be raised." msgstr "" -#: ../../library/functions.rst:1260 +#: ../../library/functions.rst:1268 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2143,11 +2153,11 @@ msgid "" "similar to passing ``None``)." msgstr "" -#: ../../library/functions.rst:1266 +#: ../../library/functions.rst:1274 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1268 +#: ../../library/functions.rst:1276 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2157,7 +2167,7 @@ msgstr "" "\n" "::" -#: ../../library/functions.rst:1281 +#: ../../library/functions.rst:1289 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2172,7 +2182,7 @@ msgid "" "FileIO`, is returned." msgstr "" -#: ../../library/functions.rst:1302 +#: ../../library/functions.rst:1310 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2182,31 +2192,31 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1306 +#: ../../library/functions.rst:1314 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``file``, " "``mode``, ``flags``." msgstr "" -#: ../../library/functions.rst:1308 +#: ../../library/functions.rst:1316 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "" -#: ../../library/functions.rst:1314 +#: ../../library/functions.rst:1322 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1315 +#: ../../library/functions.rst:1323 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1316 +#: ../../library/functions.rst:1324 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去觸發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1317 +#: ../../library/functions.rst:1325 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2214,15 +2224,15 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (\\ ``'x'``\\ ),現在會觸發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:1331 msgid "The file is now non-inheritable." msgstr "檔案在當前版本開始禁止繼承。" -#: ../../library/functions.rst:1327 +#: ../../library/functions.rst:1335 msgid "The ``'U'`` mode." msgstr "``'U'`` 模式。" -#: ../../library/functions.rst:1332 +#: ../../library/functions.rst:1340 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2231,15 +2241,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程序沒有觸發例外,此函式現在會重試系統呼叫,而" "不是觸發 :exc:`InterruptedError`\\ (原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1335 +#: ../../library/functions.rst:1343 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1340 +#: ../../library/functions.rst:1348 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對實現了 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1341 +#: ../../library/functions.rst:1349 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2247,7 +2257,7 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1354 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2258,7 +2268,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、\\ ``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1354 +#: ../../library/functions.rst:1362 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2269,7 +2279,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1367 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2282,7 +2292,7 @@ msgid "" "close to ``3j``." msgstr "" -#: ../../library/functions.rst:1369 +#: ../../library/functions.rst:1377 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2291,29 +2301,29 @@ msgid "" "*base* modulo *mod*." msgstr "" -#: ../../library/functions.rst:1375 +#: ../../library/functions.rst:1383 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "" -#: ../../library/functions.rst:1382 +#: ../../library/functions.rst:1390 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." msgstr "" -#: ../../library/functions.rst:1387 +#: ../../library/functions.rst:1395 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "" -#: ../../library/functions.rst:1394 +#: ../../library/functions.rst:1402 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " "keyword arguments." msgstr "" -#: ../../library/functions.rst:1398 +#: ../../library/functions.rst:1406 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2322,7 +2332,7 @@ msgid "" "*end*." msgstr "" -#: ../../library/functions.rst:1404 +#: ../../library/functions.rst:1412 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2330,38 +2340,38 @@ msgid "" "binary mode file objects. For these, use ``file.write(...)`` instead." msgstr "" -#: ../../library/functions.rst:1409 +#: ../../library/functions.rst:1417 msgid "" "Whether the output is buffered is usually determined by *file*, but if the " "*flush* keyword argument is true, the stream is forcibly flushed." msgstr "" -#: ../../library/functions.rst:1412 +#: ../../library/functions.rst:1420 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1418 +#: ../../library/functions.rst:1426 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1420 +#: ../../library/functions.rst:1428 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " "attribute value. And *doc* creates a docstring for the attribute." msgstr "" -#: ../../library/functions.rst:1424 +#: ../../library/functions.rst:1432 msgid "A typical use is to define a managed attribute ``x``::" msgstr "" -#: ../../library/functions.rst:1441 +#: ../../library/functions.rst:1449 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" -#: ../../library/functions.rst:1444 +#: ../../library/functions.rst:1452 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2369,14 +2379,14 @@ msgid "" "term:`decorator`::" msgstr "" -#: ../../library/functions.rst:1457 +#: ../../library/functions.rst:1465 msgid "" "The ``@property`` decorator turns the :meth:`voltage` method into a \"getter" "\" for a read-only attribute with the same name, and it sets the docstring " "for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1461 +#: ../../library/functions.rst:1469 msgid "" "A property object has :attr:`~property.getter`, :attr:`~property.setter`, " "and :attr:`~property.deleter` methods usable as decorators that create a " @@ -2384,30 +2394,30 @@ msgid "" "decorated function. This is best explained with an example::" msgstr "" -#: ../../library/functions.rst:1483 +#: ../../library/functions.rst:1491 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1487 +#: ../../library/functions.rst:1495 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1490 +#: ../../library/functions.rst:1498 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1499 +#: ../../library/functions.rst:1507 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1513 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -2420,7 +2430,7 @@ msgid "" "`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1518 +#: ../../library/functions.rst:1526 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`__reversed__` method or supports the sequence protocol (the :meth:" @@ -2428,14 +2438,14 @@ msgid "" "starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1526 +#: ../../library/functions.rst:1534 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1530 +#: ../../library/functions.rst:1538 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -2446,13 +2456,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1539 +#: ../../library/functions.rst:1547 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1544 +#: ../../library/functions.rst:1552 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -2461,21 +2471,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1555 +#: ../../library/functions.rst:1563 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1559 +#: ../../library/functions.rst:1567 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1566 +#: ../../library/functions.rst:1574 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -2484,14 +2494,14 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1574 +#: ../../library/functions.rst:1582 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1583 +#: ../../library/functions.rst:1591 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " @@ -2504,35 +2514,35 @@ msgid "" "func:`itertools.islice` for an alternate version that returns an iterator." msgstr "" -#: ../../library/functions.rst:1596 +#: ../../library/functions.rst:1604 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1598 +#: ../../library/functions.rst:1606 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1600 +#: ../../library/functions.rst:1608 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1604 +#: ../../library/functions.rst:1612 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1607 +#: ../../library/functions.rst:1615 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1610 +#: ../../library/functions.rst:1618 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -2540,7 +2550,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1615 +#: ../../library/functions.rst:1623 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -2552,22 +2562,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1632 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1628 +#: ../../library/functions.rst:1636 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1630 +#: ../../library/functions.rst:1638 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1637 +#: ../../library/functions.rst:1645 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -2575,21 +2585,21 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1640 +#: ../../library/functions.rst:1648 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, they can be called as regular " "functions (such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1644 +#: ../../library/functions.rst:1652 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1648 +#: ../../library/functions.rst:1656 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -2598,36 +2608,36 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1660 +#: ../../library/functions.rst:1668 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1662 +#: ../../library/functions.rst:1670 msgid "" "Static methods now inherit the method attributes (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " "new ``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -#: ../../library/functions.rst:1677 +#: ../../library/functions.rst:1685 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1679 +#: ../../library/functions.rst:1687 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1685 +#: ../../library/functions.rst:1693 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1689 +#: ../../library/functions.rst:1697 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -2636,31 +2646,31 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1695 +#: ../../library/functions.rst:1703 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1700 +#: ../../library/functions.rst:1708 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1704 +#: ../../library/functions.rst:1712 msgid "" "The *object-or-type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1708 +#: ../../library/functions.rst:1716 msgid "" "For example, if :attr:`~class.__mro__` of *object-or-type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1712 +#: ../../library/functions.rst:1720 msgid "" "The :attr:`~class.__mro__` attribute of the *object-or-type* lists the " "method resolution search order used by both :func:`getattr` and :func:" @@ -2668,7 +2678,7 @@ msgid "" "hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1717 +#: ../../library/functions.rst:1725 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -2676,7 +2686,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1722 +#: ../../library/functions.rst:1730 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -2684,7 +2694,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1727 +#: ../../library/functions.rst:1735 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -2697,18 +2707,18 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1737 +#: ../../library/functions.rst:1745 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1744 +#: ../../library/functions.rst:1752 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:1748 +#: ../../library/functions.rst:1756 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -2718,7 +2728,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1763 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -2728,33 +2738,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:1762 +#: ../../library/functions.rst:1770 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:1771 +#: ../../library/functions.rst:1779 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1780 +#: ../../library/functions.rst:1788 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__ `." msgstr "" -#: ../../library/functions.rst:1784 +#: ../../library/functions.rst:1792 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:1788 +#: ../../library/functions.rst:1796 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -2767,11 +2777,11 @@ msgid "" "identical :class:`type` objects:" msgstr "" -#: ../../library/functions.rst:1803 +#: ../../library/functions.rst:1811 msgid "See also :ref:`bltin-type-objects`." msgstr "另請參閱 :ref:`bltin-type-objects`。" -#: ../../library/functions.rst:1805 +#: ../../library/functions.rst:1813 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -2779,23 +2789,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:1810 +#: ../../library/functions.rst:1818 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:1812 +#: ../../library/functions.rst:1820 msgid "" "Subclasses of :class:`type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:1818 +#: ../../library/functions.rst:1826 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/functions.rst:1821 +#: ../../library/functions.rst:1829 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -2803,54 +2813,54 @@ msgid "" "`types.MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:1826 +#: ../../library/functions.rst:1834 msgid "" "Without an argument, :func:`vars` acts like :func:`locals`. Note, the " "locals dictionary is only useful for reads since updates to the locals " "dictionary are ignored." msgstr "" -#: ../../library/functions.rst:1830 +#: ../../library/functions.rst:1838 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:1836 +#: ../../library/functions.rst:1844 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:1839 +#: ../../library/functions.rst:1847 msgid "Example::" msgstr "" "例如:\n" "\n" "::" -#: ../../library/functions.rst:1848 +#: ../../library/functions.rst:1856 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:1851 +#: ../../library/functions.rst:1859 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:1855 +#: ../../library/functions.rst:1863 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:1859 +#: ../../library/functions.rst:1867 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -2858,51 +2868,51 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:1864 +#: ../../library/functions.rst:1872 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:1871 +#: ../../library/functions.rst:1879 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:1878 +#: ../../library/functions.rst:1886 msgid "" "Unlike the default behavior, it checks that the lengths of iterables are " "identical, raising a :exc:`ValueError` if they aren't:" msgstr "" -#: ../../library/functions.rst:1886 +#: ../../library/functions.rst:1894 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:1890 +#: ../../library/functions.rst:1898 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:1894 +#: ../../library/functions.rst:1902 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:1897 +#: ../../library/functions.rst:1905 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:1899 +#: ../../library/functions.rst:1907 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -2911,23 +2921,23 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:1905 +#: ../../library/functions.rst:1913 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:1916 +#: ../../library/functions.rst:1924 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:1928 +#: ../../library/functions.rst:1936 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1931 +#: ../../library/functions.rst:1939 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -2939,7 +2949,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1940 +#: ../../library/functions.rst:1948 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -2949,7 +2959,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:1947 +#: ../../library/functions.rst:1955 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -2958,7 +2968,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:1953 +#: ../../library/functions.rst:1961 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -2966,58 +2976,58 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:1958 +#: ../../library/functions.rst:1966 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:1963 +#: ../../library/functions.rst:1971 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1975 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:1970 +#: ../../library/functions.rst:1978 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:1977 +#: ../../library/functions.rst:1985 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:1981 +#: ../../library/functions.rst:1989 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:1984 +#: ../../library/functions.rst:1992 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:1988 +#: ../../library/functions.rst:1996 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:1993 +#: ../../library/functions.rst:2001 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:1994 +#: ../../library/functions.rst:2002 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " diff --git a/library/json.po b/library/json.po index 4028ac1ceba..4d080ca4e58 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,45 +37,52 @@ msgid "" "strict subset of JavaScript [#rfc-errata]_ )." msgstr "" -#: ../../library/json.rst:21 +#: ../../library/json.rst:22 +msgid "" +"Be cautious when parsing JSON data from untrusted sources. A malicious JSON " +"string may cause the decoder to consume considerable CPU and memory " +"resources. Limiting the size of data to be parsed is recommended." +msgstr "" + +#: ../../library/json.rst:26 msgid "" ":mod:`json` exposes an API familiar to users of the standard library :mod:" "`marshal` and :mod:`pickle` modules." msgstr "" -#: ../../library/json.rst:24 +#: ../../library/json.rst:29 msgid "Encoding basic Python object hierarchies::" msgstr "" -#: ../../library/json.rst:43 +#: ../../library/json.rst:48 msgid "Compact encoding::" msgstr "" -#: ../../library/json.rst:49 +#: ../../library/json.rst:54 msgid "Pretty printing::" msgstr "美化輸出:" -#: ../../library/json.rst:58 +#: ../../library/json.rst:63 msgid "Decoding JSON::" msgstr "" -#: ../../library/json.rst:70 +#: ../../library/json.rst:75 msgid "Specializing JSON object decoding::" msgstr "" -#: ../../library/json.rst:85 +#: ../../library/json.rst:90 msgid "Extending :class:`JSONEncoder`::" msgstr "" -#: ../../library/json.rst:103 +#: ../../library/json.rst:108 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" msgstr "" -#: ../../library/json.rst:114 +#: ../../library/json.rst:119 msgid "See :ref:`json-commandline` for detailed documentation." msgstr "更詳盡的文件請見 :ref:`json-commandline`\\ 。" -#: ../../library/json.rst:118 +#: ../../library/json.rst:123 msgid "" "JSON is a subset of `YAML `_ 1.2. The JSON produced by " "this module's default settings (in particular, the default *separators* " @@ -83,51 +90,51 @@ msgid "" "used as a YAML serializer." msgstr "" -#: ../../library/json.rst:125 +#: ../../library/json.rst:130 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." msgstr "" -#: ../../library/json.rst:130 +#: ../../library/json.rst:135 msgid "Basic Usage" msgstr "基本用法" -#: ../../library/json.rst:137 +#: ../../library/json.rst:142 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" -#: ../../library/json.rst:141 +#: ../../library/json.rst:146 msgid "" "If *skipkeys* is true (default: ``False``), then dict 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`." msgstr "" -#: ../../library/json.rst:145 +#: ../../library/json.rst:150 msgid "" "The :mod:`json` module always produces :class:`str` objects, not :class:" "`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." msgstr "" -#: ../../library/json.rst:149 ../../library/json.rst:422 +#: ../../library/json.rst:154 ../../library/json.rst:433 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." msgstr "" -#: ../../library/json.rst:153 +#: ../../library/json.rst:158 msgid "" "If *check_circular* is false (default: ``True``), then the circular " "reference check for container types will be skipped and a circular reference " "will result in an :exc:`RecursionError` (or worse)." msgstr "" -#: ../../library/json.rst:157 +#: ../../library/json.rst:162 msgid "" "If *allow_nan* is false (default: ``True``), then it will be a :exc:" "`ValueError` to serialize out of range :class:`float` values (``nan``, " @@ -136,7 +143,7 @@ msgid "" "Infinity``) will be used." msgstr "" -#: ../../library/json.rst:163 ../../library/json.rst:441 +#: ../../library/json.rst:168 ../../library/json.rst:452 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 " @@ -146,11 +153,11 @@ msgid "" "``\"\\t\"``), that string is used to indent each level." msgstr "" -#: ../../library/json.rst:170 ../../library/json.rst:448 +#: ../../library/json.rst:175 ../../library/json.rst:459 msgid "Allow strings for *indent* in addition to integers." msgstr "" -#: ../../library/json.rst:173 ../../library/json.rst:451 +#: ../../library/json.rst:178 ../../library/json.rst:462 msgid "" "If specified, *separators* should be an ``(item_separator, key_separator)`` " "tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " @@ -158,11 +165,11 @@ msgid "" "specify ``(',', ':')`` to eliminate whitespace." msgstr "" -#: ../../library/json.rst:178 ../../library/json.rst:456 +#: ../../library/json.rst:183 ../../library/json.rst:467 msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." msgstr "" -#: ../../library/json.rst:181 ../../library/json.rst:459 +#: ../../library/json.rst:186 ../../library/json.rst:470 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 " @@ -170,39 +177,39 @@ msgid "" "`TypeError` is raised." msgstr "" -#: ../../library/json.rst:186 +#: ../../library/json.rst:191 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key." msgstr "" -#: ../../library/json.rst:189 +#: ../../library/json.rst:194 msgid "" "To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :" "meth:`default` method to serialize additional types), specify it with the " "*cls* kwarg; otherwise :class:`JSONEncoder` is used." msgstr "" -#: ../../library/json.rst:193 ../../library/json.rst:266 +#: ../../library/json.rst:198 ../../library/json.rst:277 msgid "" "All optional parameters are now :ref:`keyword-only `." msgstr "" -#: ../../library/json.rst:198 +#: ../../library/json.rst:203 msgid "" "Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " "trying to serialize multiple objects with repeated calls to :func:`dump` " "using the same *fp* will result in an invalid JSON file." msgstr "" -#: ../../library/json.rst:207 +#: ../../library/json.rst:212 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -#: ../../library/json.rst:213 +#: ../../library/json.rst:218 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 " @@ -211,14 +218,14 @@ msgid "" "original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys." msgstr "" -#: ../../library/json.rst:222 +#: ../../library/json.rst:227 msgid "" "Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" "`binary file` containing a JSON document) to a Python object using this :ref:" "`conversion table `." msgstr "" -#: ../../library/json.rst:226 +#: ../../library/json.rst:231 msgid "" "*object_hook* is an optional function that will be called with the result of " "any object literal decoded (a :class:`dict`). The return value of " @@ -227,7 +234,7 @@ msgid "" "org>`_ class hinting)." msgstr "" -#: ../../library/json.rst:232 +#: ../../library/json.rst:237 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of any object literal decoded with an ordered list of pairs. The " @@ -236,11 +243,11 @@ msgid "" "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:238 ../../library/json.rst:337 +#: ../../library/json.rst:243 ../../library/json.rst:348 msgid "Added support for *object_pairs_hook*." msgstr "新增對於 *object_pairs_hook* 的支援。" -#: ../../library/json.rst:241 ../../library/json.rst:340 +#: ../../library/json.rst:246 ../../library/json.rst:351 msgid "" "*parse_float*, if specified, will be called with the string of every JSON " "float to be decoded. By default, this is equivalent to ``float(num_str)``. " @@ -248,7 +255,7 @@ msgid "" "class:`decimal.Decimal`)." msgstr "" -#: ../../library/json.rst:246 ../../library/json.rst:345 +#: ../../library/json.rst:251 ../../library/json.rst:356 msgid "" "*parse_int*, if specified, will be called with the string of every JSON int " "to be decoded. By default, this is equivalent to ``int(num_str)``. This " @@ -256,149 +263,156 @@ msgid "" "`float`)." msgstr "" -#: ../../library/json.rst:251 ../../library/json.rst:350 +#: ../../library/json.rst:256 +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 " +"limitation ` to help avoid denial of service attacks." +msgstr "" + +#: ../../library/json.rst:262 ../../library/json.rst:361 msgid "" "*parse_constant*, if specified, will be called with one of the following " "strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to " "raise an exception if invalid JSON numbers are encountered." msgstr "" -#: ../../library/json.rst:256 +#: ../../library/json.rst:267 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" -#: ../../library/json.rst:259 +#: ../../library/json.rst:270 msgid "" "To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " "will be passed to the constructor of the class." msgstr "" -#: ../../library/json.rst:263 ../../library/json.rst:281 -#: ../../library/json.rst:360 +#: ../../library/json.rst:274 ../../library/json.rst:292 +#: ../../library/json.rst:371 msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." msgstr "" -#: ../../library/json.rst:269 +#: ../../library/json.rst:280 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." msgstr "" -#: ../../library/json.rst:275 +#: ../../library/json.rst:286 msgid "" "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 "" -#: ../../library/json.rst:279 +#: ../../library/json.rst:290 msgid "The other arguments have the same meaning as in :func:`load`." msgstr "" -#: ../../library/json.rst:284 +#: ../../library/json.rst:295 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." msgstr "" -#: ../../library/json.rst:288 +#: ../../library/json.rst:299 msgid "The keyword argument *encoding* has been removed." msgstr "" -#: ../../library/json.rst:293 +#: ../../library/json.rst:304 msgid "Encoders and Decoders" msgstr "" -#: ../../library/json.rst:297 +#: ../../library/json.rst:308 msgid "Simple JSON decoder." msgstr "" -#: ../../library/json.rst:299 +#: ../../library/json.rst:310 msgid "Performs the following translations in decoding by default:" msgstr "" -#: ../../library/json.rst:304 ../../library/json.rst:393 +#: ../../library/json.rst:315 ../../library/json.rst:404 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:304 ../../library/json.rst:393 +#: ../../library/json.rst:315 ../../library/json.rst:404 msgid "Python" msgstr "Python" -#: ../../library/json.rst:306 ../../library/json.rst:395 +#: ../../library/json.rst:317 ../../library/json.rst:406 msgid "object" msgstr "object" -#: ../../library/json.rst:306 ../../library/json.rst:395 +#: ../../library/json.rst:317 ../../library/json.rst:406 msgid "dict" msgstr "dict" -#: ../../library/json.rst:308 ../../library/json.rst:397 +#: ../../library/json.rst:319 ../../library/json.rst:408 msgid "array" msgstr "array" -#: ../../library/json.rst:308 +#: ../../library/json.rst:319 msgid "list" msgstr "list" -#: ../../library/json.rst:310 ../../library/json.rst:399 +#: ../../library/json.rst:321 ../../library/json.rst:410 msgid "string" msgstr "string" -#: ../../library/json.rst:310 ../../library/json.rst:399 +#: ../../library/json.rst:321 ../../library/json.rst:410 msgid "str" msgstr "str" -#: ../../library/json.rst:312 +#: ../../library/json.rst:323 msgid "number (int)" msgstr "number (int)" -#: ../../library/json.rst:312 +#: ../../library/json.rst:323 msgid "int" msgstr "int" -#: ../../library/json.rst:314 +#: ../../library/json.rst:325 msgid "number (real)" msgstr "" -#: ../../library/json.rst:314 +#: ../../library/json.rst:325 msgid "float" msgstr "float" -#: ../../library/json.rst:316 ../../library/json.rst:403 +#: ../../library/json.rst:327 ../../library/json.rst:414 msgid "true" msgstr "true" -#: ../../library/json.rst:316 ../../library/json.rst:403 +#: ../../library/json.rst:327 ../../library/json.rst:414 msgid "True" msgstr "True" -#: ../../library/json.rst:318 ../../library/json.rst:405 +#: ../../library/json.rst:329 ../../library/json.rst:416 msgid "false" msgstr "false" -#: ../../library/json.rst:318 ../../library/json.rst:405 +#: ../../library/json.rst:329 ../../library/json.rst:416 msgid "False" msgstr "False" -#: ../../library/json.rst:320 ../../library/json.rst:407 +#: ../../library/json.rst:331 ../../library/json.rst:418 msgid "null" msgstr "null" -#: ../../library/json.rst:320 ../../library/json.rst:407 +#: ../../library/json.rst:331 ../../library/json.rst:418 msgid "None" msgstr "None" -#: ../../library/json.rst:323 +#: ../../library/json.rst:334 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." msgstr "" -#: ../../library/json.rst:326 +#: ../../library/json.rst:337 msgid "" "*object_hook*, if specified, will be called with the result of every JSON " "object decoded and its return value will be used in place of the given :" @@ -406,7 +420,7 @@ msgid "" "support `JSON-RPC `_ class hinting)." msgstr "" -#: ../../library/json.rst:331 +#: ../../library/json.rst:342 msgid "" "*object_pairs_hook*, if specified will be called with the result of every " "JSON object decoded with an ordered list of pairs. The return value of " @@ -415,7 +429,7 @@ msgid "" "the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:355 +#: ../../library/json.rst:366 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -423,60 +437,60 @@ msgid "" "``'\\n'``, ``'\\r'`` and ``'\\0'``." msgstr "" -#: ../../library/json.rst:363 ../../library/json.rst:464 +#: ../../library/json.rst:374 ../../library/json.rst:475 msgid "All parameters are now :ref:`keyword-only `." msgstr "" -#: ../../library/json.rst:368 +#: ../../library/json.rst:379 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" -#: ../../library/json.rst:371 +#: ../../library/json.rst:382 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "" -#: ../../library/json.rst:376 +#: ../../library/json.rst:387 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 " "*s* where the document ended." msgstr "" -#: ../../library/json.rst:380 +#: ../../library/json.rst:391 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "" -#: ../../library/json.rst:386 +#: ../../library/json.rst:397 msgid "Extensible JSON encoder for Python data structures." msgstr "" -#: ../../library/json.rst:388 +#: ../../library/json.rst:399 msgid "Supports the following objects and types by default:" msgstr "" -#: ../../library/json.rst:397 +#: ../../library/json.rst:408 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:401 +#: ../../library/json.rst:412 msgid "int, float, int- & float-derived Enums" msgstr "" -#: ../../library/json.rst:401 +#: ../../library/json.rst:412 msgid "number" msgstr "" -#: ../../library/json.rst:410 +#: ../../library/json.rst:421 msgid "Added support for int- and float-derived Enum classes." msgstr "" -#: ../../library/json.rst:413 +#: ../../library/json.rst:424 msgid "" "To extend this to recognize other objects, subclass and implement a :meth:" "`default` method with another method that returns a serializable object for " @@ -484,14 +498,14 @@ msgid "" "(to raise :exc:`TypeError`)." msgstr "" -#: ../../library/json.rst:418 +#: ../../library/json.rst:429 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` or ``None``. If *skipkeys* is true, such items are simply skipped." msgstr "" -#: ../../library/json.rst:426 +#: ../../library/json.rst:437 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -499,7 +513,7 @@ msgid "" "Otherwise, no such check takes place." msgstr "" -#: ../../library/json.rst:431 +#: ../../library/json.rst:442 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -507,71 +521,71 @@ msgid "" "decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats." msgstr "" -#: ../../library/json.rst:437 +#: ../../library/json.rst:448 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 " "JSON serializations can be compared on a day-to-day basis." msgstr "" -#: ../../library/json.rst:470 +#: ../../library/json.rst:481 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`)." msgstr "" -#: ../../library/json.rst:474 +#: ../../library/json.rst:485 msgid "" "For example, to support arbitrary iterators, you could implement :meth:" "`default` like this::" msgstr "" -#: ../../library/json.rst:490 +#: ../../library/json.rst:501 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "" -#: ../../library/json.rst:499 +#: ../../library/json.rst:510 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" msgstr "" -#: ../../library/json.rst:507 +#: ../../library/json.rst:518 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:511 +#: ../../library/json.rst:522 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr "" -#: ../../library/json.rst:515 +#: ../../library/json.rst:526 msgid "The unformatted error message." msgstr "" -#: ../../library/json.rst:519 +#: ../../library/json.rst:530 msgid "The JSON document being parsed." msgstr "" -#: ../../library/json.rst:523 +#: ../../library/json.rst:534 msgid "The start index of *doc* where parsing failed." msgstr "" -#: ../../library/json.rst:527 +#: ../../library/json.rst:538 msgid "The line corresponding to *pos*." msgstr "" -#: ../../library/json.rst:531 +#: ../../library/json.rst:542 msgid "The column corresponding to *pos*." msgstr "" -#: ../../library/json.rst:537 +#: ../../library/json.rst:548 msgid "Standard Compliance and Interoperability" msgstr "" -#: ../../library/json.rst:539 +#: ../../library/json.rst:550 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. " @@ -580,48 +594,48 @@ msgid "" "parameters other than those explicitly mentioned, are not considered." msgstr "" -#: ../../library/json.rst:545 +#: ../../library/json.rst:556 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:" msgstr "" -#: ../../library/json.rst:548 +#: ../../library/json.rst:559 msgid "Infinite and NaN number values are accepted and output;" msgstr "" -#: ../../library/json.rst:549 +#: ../../library/json.rst:560 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "" -#: ../../library/json.rst:552 +#: ../../library/json.rst:563 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 " "under default settings." msgstr "" -#: ../../library/json.rst:557 +#: ../../library/json.rst:568 msgid "Character Encodings" msgstr "" -#: ../../library/json.rst:559 +#: ../../library/json.rst:570 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 " "interoperability." msgstr "" -#: ../../library/json.rst:562 +#: ../../library/json.rst:573 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." msgstr "" -#: ../../library/json.rst:566 +#: ../../library/json.rst:577 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " @@ -629,7 +643,7 @@ msgid "" "encodings." msgstr "" -#: ../../library/json.rst:571 +#: ../../library/json.rst:582 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 " @@ -638,7 +652,7 @@ msgid "" "an initial BOM is present." msgstr "" -#: ../../library/json.rst:577 +#: ../../library/json.rst:588 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 " @@ -647,29 +661,29 @@ msgid "" "class:`str`) code points for such sequences." msgstr "" -#: ../../library/json.rst:585 +#: ../../library/json.rst:596 msgid "Infinite and NaN Number Values" msgstr "" -#: ../../library/json.rst:587 +#: ../../library/json.rst:598 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" "Infinity``, and ``NaN`` as if they were valid JSON number literal values::" msgstr "" -#: ../../library/json.rst:602 +#: ../../library/json.rst:613 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 " "to alter this behavior." msgstr "" -#: ../../library/json.rst:608 +#: ../../library/json.rst:619 msgid "Repeated Names Within an Object" msgstr "" -#: ../../library/json.rst:610 +#: ../../library/json.rst:621 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 " @@ -677,15 +691,15 @@ msgid "" "but the last name-value pair for a given name::" msgstr "" -#: ../../library/json.rst:619 +#: ../../library/json.rst:630 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "" -#: ../../library/json.rst:623 +#: ../../library/json.rst:634 msgid "Top-level Non-Object, Non-Array Values" msgstr "" -#: ../../library/json.rst:625 +#: ../../library/json.rst:636 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 " @@ -695,43 +709,43 @@ msgid "" "its serializer or its deserializer." msgstr "" -#: ../../library/json.rst:632 +#: ../../library/json.rst:643 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "" -#: ../../library/json.rst:637 +#: ../../library/json.rst:648 msgid "Implementation Limitations" msgstr "" -#: ../../library/json.rst:639 +#: ../../library/json.rst:650 msgid "Some JSON deserializer implementations may set limits on:" msgstr "" -#: ../../library/json.rst:641 +#: ../../library/json.rst:652 msgid "the size of accepted JSON texts" msgstr "" -#: ../../library/json.rst:642 +#: ../../library/json.rst:653 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "" -#: ../../library/json.rst:643 +#: ../../library/json.rst:654 msgid "the range and precision of JSON numbers" msgstr "" -#: ../../library/json.rst:644 +#: ../../library/json.rst:655 msgid "the content and maximum length of JSON strings" msgstr "" -#: ../../library/json.rst:646 +#: ../../library/json.rst:657 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." msgstr "" -#: ../../library/json.rst:649 +#: ../../library/json.rst:660 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 " @@ -742,77 +756,77 @@ msgid "" "as :class:`decimal.Decimal`." msgstr "" -#: ../../library/json.rst:662 +#: ../../library/json.rst:673 msgid "Command Line Interface" msgstr "" -#: ../../library/json.rst:667 +#: ../../library/json.rst:678 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:671 +#: ../../library/json.rst:682 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" -#: ../../library/json.rst:674 +#: ../../library/json.rst:685 msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "attr:`sys.stdin` and :attr:`sys.stdout` will be used respectively:" msgstr "" -#: ../../library/json.rst:686 +#: ../../library/json.rst:697 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." msgstr "" -#: ../../library/json.rst:693 +#: ../../library/json.rst:704 msgid "Command line options" msgstr "" -#: ../../library/json.rst:697 +#: ../../library/json.rst:708 msgid "The JSON file to be validated or pretty-printed:" msgstr "" -#: ../../library/json.rst:713 +#: ../../library/json.rst:724 msgid "If *infile* is not specified, read from :attr:`sys.stdin`." msgstr "" -#: ../../library/json.rst:717 +#: ../../library/json.rst:728 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :attr:`sys.stdout`." msgstr "" -#: ../../library/json.rst:722 +#: ../../library/json.rst:733 msgid "Sort the output of dictionaries alphabetically by key." msgstr "" -#: ../../library/json.rst:728 +#: ../../library/json.rst:739 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "" -#: ../../library/json.rst:734 +#: ../../library/json.rst:745 msgid "Parse every input line as separate JSON object." msgstr "" -#: ../../library/json.rst:740 +#: ../../library/json.rst:751 msgid "Mutually exclusive options for whitespace control." msgstr "" -#: ../../library/json.rst:746 +#: ../../library/json.rst:757 msgid "Show the help message." msgstr "" -#: ../../library/json.rst:750 +#: ../../library/json.rst:761 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:751 +#: ../../library/json.rst:762 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 1107fa60060..93ff5522aa2 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-31 00:21+0000\n" +"POT-Creation-Date: 2022-09-04 00:18+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1428,7 +1428,7 @@ msgid "" msgstr "" #: ../../library/logging.handlers.rst:1034 -#: ../../library/logging.handlers.rst:1109 +#: ../../library/logging.handlers.rst:1123 msgid "" "If you are using :mod:`multiprocessing`, you should avoid using :class:" "`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`." @@ -1467,25 +1467,41 @@ msgid "" "the original intact." msgstr "" -#: ../../library/logging.handlers.rst:1065 +#: ../../library/logging.handlers.rst:1063 +msgid "" +"The base implementation formats the message with arguments, sets the " +"``message`` and ``msg`` attributes to the formatted message and sets the " +"``args`` and ``exc_text`` attributes to ``None`` to allow pickling and to " +"prevent further attempts at formatting. This means that a handler on the :" +"class:`QueueListener` side won't have the information to do custom " +"formatting, e.g. of exceptions. You may wish to subclass ``QueueHandler`` " +"and override this method to e.g. avoid setting ``exc_text`` to ``None``. " +"Note that the ``message`` / ``msg`` / ``args`` changes are related to " +"ensuring the record is pickleable, and you might or might not be able to " +"avoid doing that depending on whether your ``args`` are pickleable. (Note " +"that you may have to consider not only your own code but also code in any " +"libraries that you use.)" +msgstr "" + +#: ../../library/logging.handlers.rst:1079 msgid "" "Enqueues the record on the queue using ``put_nowait()``; you may want to " "override this if you want to use blocking behaviour, or a timeout, or a " "customized queue implementation." msgstr "" -#: ../../library/logging.handlers.rst:1071 +#: ../../library/logging.handlers.rst:1085 msgid "" "When created via configuration using :func:`~logging.config.dictConfig`, " "this attribute will contain a :class:`QueueListener` instance for use with " "this handler. Otherwise, it will be ``None``." msgstr "" -#: ../../library/logging.handlers.rst:1080 +#: ../../library/logging.handlers.rst:1094 msgid "QueueListener" msgstr "QueueListener" -#: ../../library/logging.handlers.rst:1084 +#: ../../library/logging.handlers.rst:1098 msgid "" "The :class:`QueueListener` class, located in the :mod:`logging.handlers` " "module, supports receiving logging messages from a queue, such as those " @@ -1496,7 +1512,7 @@ msgid "" "works hand-in-hand with :class:`QueueHandler`." msgstr "" -#: ../../library/logging.handlers.rst:1092 +#: ../../library/logging.handlers.rst:1106 msgid "" "Along with the :class:`QueueHandler` class, :class:`QueueListener` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1506,7 +1522,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: ../../library/logging.handlers.rst:1101 +#: ../../library/logging.handlers.rst:1115 msgid "" "Returns a new instance of the :class:`QueueListener` class. The instance is " "initialized with the queue to send messages to and a list of handlers which " @@ -1517,7 +1533,7 @@ msgid "" "class:`~queue.SimpleQueue` instances for *queue*." msgstr "" -#: ../../library/logging.handlers.rst:1112 +#: ../../library/logging.handlers.rst:1126 msgid "" "If ``respect_handler_level`` is ``True``, a handler's level is respected " "(compared with the level for the message) when deciding whether to pass " @@ -1525,82 +1541,82 @@ msgid "" "versions - to always pass each message to each handler." msgstr "" -#: ../../library/logging.handlers.rst:1117 +#: ../../library/logging.handlers.rst:1131 msgid "The ``respect_handler_level`` argument was added." msgstr "新增 ``respect_handler_level`` 引數。" -#: ../../library/logging.handlers.rst:1122 +#: ../../library/logging.handlers.rst:1136 msgid "Dequeues a record and return it, optionally blocking." msgstr "" -#: ../../library/logging.handlers.rst:1124 +#: ../../library/logging.handlers.rst:1138 msgid "" "The base implementation uses ``get()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1130 +#: ../../library/logging.handlers.rst:1144 msgid "Prepare a record for handling." msgstr "" -#: ../../library/logging.handlers.rst:1132 +#: ../../library/logging.handlers.rst:1146 msgid "" "This implementation just returns the passed-in record. You may want to " "override this method if you need to do any custom marshalling or " "manipulation of the record before passing it to the handlers." msgstr "" -#: ../../library/logging.handlers.rst:1138 +#: ../../library/logging.handlers.rst:1152 msgid "Handle a record." msgstr "" -#: ../../library/logging.handlers.rst:1140 +#: ../../library/logging.handlers.rst:1154 msgid "" "This just loops through the handlers offering them the record to handle. The " "actual object passed to the handlers is that which is returned from :meth:" "`prepare`." msgstr "" -#: ../../library/logging.handlers.rst:1146 +#: ../../library/logging.handlers.rst:1160 msgid "Starts the listener." msgstr "" -#: ../../library/logging.handlers.rst:1148 +#: ../../library/logging.handlers.rst:1162 msgid "" "This starts up a background thread to monitor the queue for LogRecords to " "process." msgstr "" -#: ../../library/logging.handlers.rst:1153 +#: ../../library/logging.handlers.rst:1167 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1155 +#: ../../library/logging.handlers.rst:1169 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1161 +#: ../../library/logging.handlers.rst:1175 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1172 +#: ../../library/logging.handlers.rst:1186 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1172 +#: ../../library/logging.handlers.rst:1186 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1174 +#: ../../library/logging.handlers.rst:1188 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1175 +#: ../../library/logging.handlers.rst:1189 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/numbers.po b/library/numbers.po index aaef74cb624..c86a345252c 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2022-09-05 00:20+0000\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,15 +89,22 @@ msgstr "" #: ../../library/numbers.rst:61 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" -"`~Rational.denominator` properties, which should be in lowest terms. With " -"these, it provides a default for :func:`float`." +"`~Rational.denominator` properties. It also provides a default for :func:" +"`float`." msgstr "" -#: ../../library/numbers.rst:68 ../../library/numbers.rst:72 +#: ../../library/numbers.rst:65 +msgid "" +"The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " +"should be instances of :class:`Integral` and should be in lowest terms with :" +"attr:`~Rational.denominator` positive." +msgstr "" + +#: ../../library/numbers.rst:71 ../../library/numbers.rst:75 msgid "Abstract." msgstr "" -#: ../../library/numbers.rst:77 +#: ../../library/numbers.rst:80 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" @@ -105,11 +112,11 @@ msgid "" "and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." msgstr "" -#: ../../library/numbers.rst:85 +#: ../../library/numbers.rst:88 msgid "Notes for type implementors" msgstr "" -#: ../../library/numbers.rst:87 +#: ../../library/numbers.rst:90 msgid "" "Implementors should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " @@ -117,22 +124,22 @@ msgid "" "`hash` as follows::" msgstr "" -#: ../../library/numbers.rst:106 +#: ../../library/numbers.rst:109 msgid "Adding More Numeric ABCs" msgstr "" -#: ../../library/numbers.rst:108 +#: ../../library/numbers.rst:111 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" -#: ../../library/numbers.rst:120 +#: ../../library/numbers.rst:123 msgid "Implementing the arithmetic operations" msgstr "" -#: ../../library/numbers.rst:122 +#: ../../library/numbers.rst:125 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " @@ -141,7 +148,7 @@ msgid "" "and :meth:`__radd__` should be defined as::" msgstr "" -#: ../../library/numbers.rst:153 +#: ../../library/numbers.rst:156 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " @@ -150,11 +157,11 @@ msgid "" "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" -#: ../../library/numbers.rst:160 +#: ../../library/numbers.rst:163 msgid "If ``A`` defines an :meth:`__add__` which accepts ``b``, all is well." msgstr "" -#: ../../library/numbers.rst:162 +#: ../../library/numbers.rst:165 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`__add__`, we'd miss the possibility that ``B`` defines a more " @@ -163,33 +170,33 @@ msgid "" "`__add__` at all.)" msgstr "" -#: ../../library/numbers.rst:168 +#: ../../library/numbers.rst:171 msgid "" "Then ``B``'s :meth:`__radd__` gets a chance. If it accepts ``a``, all is " "well." msgstr "" -#: ../../library/numbers.rst:170 +#: ../../library/numbers.rst:173 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." msgstr "" -#: ../../library/numbers.rst:173 +#: ../../library/numbers.rst:176 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " "instances before delegating to :class:`Complex`." msgstr "" -#: ../../library/numbers.rst:178 +#: ../../library/numbers.rst:181 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" "class:`complex`, and both :meth:`__radd__` s land there, so ``a+b == b+a``." msgstr "" -#: ../../library/numbers.rst:183 +#: ../../library/numbers.rst:186 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " diff --git a/library/sqlite3.po b/library/sqlite3.po index 060976f8f01..b23767bc97d 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-31 08:54+0000\n" +"POT-Creation-Date: 2022-09-05 00:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -572,14 +572,14 @@ msgid "" "SQLite row." msgstr "" -#: ../../library/sqlite3.rst:547 ../../library/sqlite3.rst:586 -#: ../../library/sqlite3.rst:695 ../../library/sqlite3.rst:733 -#: ../../library/sqlite3.rst:952 ../../library/sqlite3.rst:1098 -#: ../../library/sqlite3.rst:1119 ../../library/sqlite3.rst:1255 +#: ../../library/sqlite3.rst:547 ../../library/sqlite3.rst:577 +#: ../../library/sqlite3.rst:686 ../../library/sqlite3.rst:724 +#: ../../library/sqlite3.rst:943 ../../library/sqlite3.rst:1089 +#: ../../library/sqlite3.rst:1110 ../../library/sqlite3.rst:1247 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:569 +#: ../../library/sqlite3.rst:560 msgid "" "If returning a tuple doesn't suffice and you want name-based access to " "columns, you should consider setting :attr:`row_factory` to the highly " @@ -589,7 +589,7 @@ msgid "" "approach or even a db_row based solution." msgstr "" -#: ../../library/sqlite3.rst:580 +#: ../../library/sqlite3.rst:571 msgid "" "A callable that accepts a :class:`bytes` parameter and returns a text " "representation of it. The callable is invoked for SQLite values with the " @@ -597,78 +597,78 @@ msgid "" "you want to return ``bytes`` instead, set *text_factory* to ``bytes``." msgstr "" -#: ../../library/sqlite3.rst:620 +#: ../../library/sqlite3.rst:611 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:626 +#: ../../library/sqlite3.rst:617 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a callable " "returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:633 +#: ../../library/sqlite3.rst:624 msgid "" "Commit any pending transaction to the database. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:638 +#: ../../library/sqlite3.rst:629 msgid "" "Roll back to the start of any pending transaction. If there is no open " "transaction, this method is a no-op." msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:634 msgid "" "Close the database connection. Any pending transaction is not committed " "implicitly; make sure to :meth:`commit` before closing to avoid losing " "pending changes." msgstr "" -#: ../../library/sqlite3.rst:650 +#: ../../library/sqlite3.rst:641 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:656 +#: ../../library/sqlite3.rst:647 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:662 +#: ../../library/sqlite3.rst:653 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:668 +#: ../../library/sqlite3.rst:659 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:670 +#: ../../library/sqlite3.rst:661 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:673 +#: ../../library/sqlite3.rst:664 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:677 +#: ../../library/sqlite3.rst:668 msgid "" "A callable that is called when the SQL function is invoked. The callable " "must return :ref:`a type natively supported by SQLite `. Set " "to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:684 +#: ../../library/sqlite3.rst:675 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " @@ -679,29 +679,29 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:689 +#: ../../library/sqlite3.rst:680 msgid "If *deterministic* is used with SQLite versions older than 3.8.3." msgstr "" -#: ../../library/sqlite3.rst:692 +#: ../../library/sqlite3.rst:683 msgid "The *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:711 +#: ../../library/sqlite3.rst:702 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:713 +#: ../../library/sqlite3.rst:704 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:716 +#: ../../library/sqlite3.rst:707 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:720 +#: ../../library/sqlite3.rst:711 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -710,64 +710,64 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:721 +#: ../../library/sqlite3.rst:712 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:723 +#: ../../library/sqlite3.rst:714 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:724 +#: ../../library/sqlite3.rst:715 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:727 +#: ../../library/sqlite3.rst:718 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:730 +#: ../../library/sqlite3.rst:721 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:765 +#: ../../library/sqlite3.rst:756 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:760 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:770 +#: ../../library/sqlite3.rst:761 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:771 +#: ../../library/sqlite3.rst:762 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:773 +#: ../../library/sqlite3.rst:764 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:801 +#: ../../library/sqlite3.rst:792 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:806 +#: ../../library/sqlite3.rst:797 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an exception." msgstr "" -#: ../../library/sqlite3.rst:813 +#: ../../library/sqlite3.rst:804 msgid "" "Register callable *authorizer_callback* to be invoked for each attempt to " "access a column of a table in the database. The callback should return one " @@ -776,7 +776,7 @@ msgid "" "library." msgstr "" -#: ../../library/sqlite3.rst:819 +#: ../../library/sqlite3.rst:810 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -786,7 +786,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:826 +#: ../../library/sqlite3.rst:817 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -794,7 +794,7 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:824 msgid "" "Register callable *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -802,26 +802,26 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:838 +#: ../../library/sqlite3.rst:829 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:841 +#: ../../library/sqlite3.rst:832 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise an :exc:`OperationalError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:848 +#: ../../library/sqlite3.rst:839 msgid "" "Register callable *trace_callback* to be invoked for each SQL statement that " "is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:851 +#: ../../library/sqlite3.rst:842 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -831,18 +831,18 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:859 +#: ../../library/sqlite3.rst:850 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:862 +#: ../../library/sqlite3.rst:853 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:872 +#: ../../library/sqlite3.rst:863 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -851,7 +851,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:881 +#: ../../library/sqlite3.rst:872 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -860,61 +860,61 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:888 +#: ../../library/sqlite3.rst:879 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: ../../library/sqlite3.rst:892 +#: ../../library/sqlite3.rst:883 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:935 +#: ../../library/sqlite3.rst:926 msgid "" "Load an SQLite extension from a shared library located at *path*. Enable " "extension loading with :meth:`enable_load_extension` before calling this " "method." msgstr "" -#: ../../library/sqlite3.rst:939 +#: ../../library/sqlite3.rst:930 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:934 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: ../../library/sqlite3.rst:948 +#: ../../library/sqlite3.rst:939 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:966 +#: ../../library/sqlite3.rst:957 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:968 +#: ../../library/sqlite3.rst:959 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:971 +#: ../../library/sqlite3.rst:962 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:974 +#: ../../library/sqlite3.rst:965 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:980 +#: ../../library/sqlite3.rst:971 msgid "" "If set to a callable, it is invoked with three integer arguments for every " "backup iteration: the *status* of the last iteration, the *remaining* number " @@ -922,32 +922,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:989 +#: ../../library/sqlite3.rst:980 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:996 +#: ../../library/sqlite3.rst:987 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1000 +#: ../../library/sqlite3.rst:991 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1019 +#: ../../library/sqlite3.rst:1010 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1033 +#: ../../library/sqlite3.rst:1024 msgid "Cursor objects" msgstr "" -#: ../../library/sqlite3.rst:1035 +#: ../../library/sqlite3.rst:1026 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -955,25 +955,25 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1042 +#: ../../library/sqlite3.rst:1033 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1067 +#: ../../library/sqlite3.rst:1058 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1074 +#: ../../library/sqlite3.rst:1065 msgid "" "Execute SQL statement *sql*. Bind values to the statement using :ref:" "`placeholders ` that map to the :term:`sequence` or :" "class:`dict` *parameters*." msgstr "" -#: ../../library/sqlite3.rst:1079 +#: ../../library/sqlite3.rst:1070 msgid "" ":meth:`execute` will only execute a single SQL statement. If you try to " "execute more than one statement with it, it will raise a :exc:`Warning`. " @@ -981,7 +981,7 @@ msgid "" "with one call." msgstr "" -#: ../../library/sqlite3.rst:1084 +#: ../../library/sqlite3.rst:1075 msgid "" "If :attr:`~Connection.isolation_level` is not ``None``, *sql* is an " "``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is " @@ -989,7 +989,7 @@ msgid "" "*sql*." msgstr "" -#: ../../library/sqlite3.rst:1092 +#: ../../library/sqlite3.rst:1083 msgid "" "Execute :ref:`parameterized ` SQL statement *sql* " "against all parameter sequences or mappings found in the sequence " @@ -998,7 +998,7 @@ msgid "" "handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1111 +#: ../../library/sqlite3.rst:1102 msgid "" "Execute the SQL statements in *sql_script*. If there is a pending " "transaction, an implicit ``COMMIT`` statement is executed first. No other " @@ -1006,23 +1006,23 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1117 +#: ../../library/sqlite3.rst:1108 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1135 +#: ../../library/sqlite3.rst:1126 msgid "" "Return the next row of a query result set as a :class:`tuple`. Return " "``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1141 +#: ../../library/sqlite3.rst:1132 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1144 +#: ../../library/sqlite3.rst:1135 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1030,7 +1030,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1150 +#: ../../library/sqlite3.rst:1141 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1038,38 +1038,55 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1157 +#: ../../library/sqlite3.rst:1148 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1164 +#: ../../library/sqlite3.rst:1155 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1166 +#: ../../library/sqlite3.rst:1157 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1171 ../../library/sqlite3.rst:1175 +#: ../../library/sqlite3.rst:1162 ../../library/sqlite3.rst:1166 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1179 +#: ../../library/sqlite3.rst:1170 msgid "" -"Read-only attribute that provides the number of modified rows for " -"``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " -"for other statements, including :abbr:`CTE (Common Table Expression)` " -"queries. It is only updated by the :meth:`execute` and :meth:`executemany` " -"methods." +"Read/write attribute that controls the number of rows returned by :meth:" +"`fetchmany`. The default value is 1 which means a single row would be " +"fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1187 +#: ../../library/sqlite3.rst:1175 +msgid "" +"Read-only attribute that provides the SQLite database :class:`Connection` " +"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" +"`con.cursor() ` will have a :attr:`connection` attribute " +"that refers to *con*:" +msgstr "" + +#: ../../library/sqlite3.rst:1189 +msgid "" +"Read-only attribute that provides the column names of the last query. To " +"remain compatible with the Python DB API, it returns a 7-tuple for each " +"column where the last six items of each tuple are ``None``." +msgstr "" + +#: ../../library/sqlite3.rst:1193 +msgid "It is set for ``SELECT`` statements without any matching rows as well." +msgstr "" + +#: ../../library/sqlite3.rst:1197 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -1079,45 +1096,28 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1195 +#: ../../library/sqlite3.rst:1205 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1197 +#: ../../library/sqlite3.rst:1207 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1202 -msgid "" -"Read/write attribute that controls the number of rows returned by :meth:" -"`fetchmany`. The default value is 1 which means a single row would be " -"fetched per call." -msgstr "" - -#: ../../library/sqlite3.rst:1207 +#: ../../library/sqlite3.rst:1212 msgid "" -"Read-only attribute that provides the column names of the last query. To " -"remain compatible with the Python DB API, it returns a 7-tuple for each " -"column where the last six items of each tuple are ``None``." -msgstr "" - -#: ../../library/sqlite3.rst:1211 -msgid "It is set for ``SELECT`` statements without any matching rows as well." -msgstr "" - -#: ../../library/sqlite3.rst:1215 -msgid "" -"Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" -"`con.cursor() ` will have a :attr:`connection` attribute " -"that refers to *con*:" +"Read-only attribute that provides the number of modified rows for " +"``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " +"for other statements, including :abbr:`CTE (Common Table Expression)` " +"queries. It is only updated by the :meth:`execute` and :meth:`executemany` " +"methods." msgstr "" -#: ../../library/sqlite3.rst:1235 +#: ../../library/sqlite3.rst:1227 msgid "Row objects" msgstr "" -#: ../../library/sqlite3.rst:1239 +#: ../../library/sqlite3.rst:1231 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -1125,41 +1125,41 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1244 +#: ../../library/sqlite3.rst:1236 msgid "Two row objects compare equal if have equal columns and equal members." msgstr "" -#: ../../library/sqlite3.rst:1248 +#: ../../library/sqlite3.rst:1240 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1252 +#: ../../library/sqlite3.rst:1244 msgid "Added support of slicing." msgstr "" -#: ../../library/sqlite3.rst:1272 +#: ../../library/sqlite3.rst:1264 msgid "PrepareProtocol objects" msgstr "" -#: ../../library/sqlite3.rst:1276 +#: ../../library/sqlite3.rst:1268 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1284 +#: ../../library/sqlite3.rst:1276 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1286 +#: ../../library/sqlite3.rst:1278 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1290 +#: ../../library/sqlite3.rst:1282 msgid "" "This exception is raised by :mod:`!sqlite3` if an SQL query is not a :class:" "`string `, or if multiple statements are passed to :meth:`~Cursor." @@ -1167,21 +1167,21 @@ msgid "" "`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1297 +#: ../../library/sqlite3.rst:1289 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1303 +#: ../../library/sqlite3.rst:1295 msgid "" "This exception is raised by :mod:`!sqlite3` for fetch across rollback, or " "if :mod:`!sqlite3` is unable to bind parameters. ``InterfaceError`` is a " "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1309 +#: ../../library/sqlite3.rst:1301 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -1189,14 +1189,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1316 +#: ../../library/sqlite3.rst:1308 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1322 +#: ../../library/sqlite3.rst:1314 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1204,20 +1204,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1330 +#: ../../library/sqlite3.rst:1322 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1335 +#: ../../library/sqlite3.rst:1327 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1334 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "trying to operate on a closed :class:`Connection`, or trying to execute non-" @@ -1225,7 +1225,7 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1349 +#: ../../library/sqlite3.rst:1341 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -1234,78 +1234,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1359 +#: ../../library/sqlite3.rst:1351 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1361 +#: ../../library/sqlite3.rst:1353 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1364 +#: ../../library/sqlite3.rst:1356 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1367 ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1359 ../../library/sqlite3.rst:1376 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1367 ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1359 ../../library/sqlite3.rst:1376 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1361 ../../library/sqlite3.rst:1378 msgid "``None``" msgstr "" -#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1361 ../../library/sqlite3.rst:1378 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1371 ../../library/sqlite3.rst:1388 +#: ../../library/sqlite3.rst:1363 ../../library/sqlite3.rst:1380 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1371 ../../library/sqlite3.rst:1388 +#: ../../library/sqlite3.rst:1363 ../../library/sqlite3.rst:1380 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1373 ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1365 ../../library/sqlite3.rst:1382 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1373 ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1365 ../../library/sqlite3.rst:1382 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1375 +#: ../../library/sqlite3.rst:1367 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1375 ../../library/sqlite3.rst:1392 +#: ../../library/sqlite3.rst:1367 ../../library/sqlite3.rst:1384 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1377 ../../library/sqlite3.rst:1395 +#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1387 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1377 ../../library/sqlite3.rst:1395 +#: ../../library/sqlite3.rst:1369 ../../library/sqlite3.rst:1387 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1381 +#: ../../library/sqlite3.rst:1373 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1392 +#: ../../library/sqlite3.rst:1384 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1398 +#: ../../library/sqlite3.rst:1390 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -1314,42 +1314,42 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1408 +#: ../../library/sqlite3.rst:1400 msgid "Default adapters and converters" msgstr "" -#: ../../library/sqlite3.rst:1410 +#: ../../library/sqlite3.rst:1402 msgid "" "There are default adapters for the date and datetime types in the datetime " "module. They will be sent as ISO dates/ISO timestamps to SQLite." msgstr "" -#: ../../library/sqlite3.rst:1413 +#: ../../library/sqlite3.rst:1405 msgid "" "The default converters are registered under the name \"date\" for :class:" "`datetime.date` and under the name \"timestamp\" for :class:`datetime." "datetime`." msgstr "" -#: ../../library/sqlite3.rst:1417 +#: ../../library/sqlite3.rst:1409 msgid "" "This way, you can use date/timestamps from Python without any additional " "fiddling in most cases. The format of the adapters is also compatible with " "the experimental SQLite date/time functions." msgstr "" -#: ../../library/sqlite3.rst:1421 +#: ../../library/sqlite3.rst:1413 msgid "The following example demonstrates this." msgstr "" -#: ../../library/sqlite3.rst:1425 +#: ../../library/sqlite3.rst:1417 msgid "" "If a timestamp stored in SQLite has a fractional part longer than 6 numbers, " "its value will be truncated to microsecond precision by the timestamp " "converter." msgstr "" -#: ../../library/sqlite3.rst:1431 +#: ../../library/sqlite3.rst:1423 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1357,15 +1357,15 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1440 +#: ../../library/sqlite3.rst:1432 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:1445 +#: ../../library/sqlite3.rst:1437 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:1447 +#: ../../library/sqlite3.rst:1439 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -1373,7 +1373,7 @@ msgid "" "com/327/>`_ for a humorous example of what can go wrong)::" msgstr "" -#: ../../library/sqlite3.rst:1456 +#: ../../library/sqlite3.rst:1448 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -1389,18 +1389,18 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:1498 +#: ../../library/sqlite3.rst:1490 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:1500 +#: ../../library/sqlite3.rst:1492 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:1504 +#: ../../library/sqlite3.rst:1496 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -1410,11 +1410,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:1516 +#: ../../library/sqlite3.rst:1508 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:1518 +#: ../../library/sqlite3.rst:1510 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -1424,84 +1424,84 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:1549 +#: ../../library/sqlite3.rst:1541 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:1551 +#: ../../library/sqlite3.rst:1543 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:1581 +#: ../../library/sqlite3.rst:1573 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:1583 +#: ../../library/sqlite3.rst:1575 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:1588 +#: ../../library/sqlite3.rst:1580 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:1591 +#: ../../library/sqlite3.rst:1583 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:1596 +#: ../../library/sqlite3.rst:1588 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:1605 +#: ../../library/sqlite3.rst:1597 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:1609 +#: ../../library/sqlite3.rst:1601 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:1610 +#: ../../library/sqlite3.rst:1602 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:1611 +#: ../../library/sqlite3.rst:1603 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:1615 +#: ../../library/sqlite3.rst:1607 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:1666 +#: ../../library/sqlite3.rst:1658 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:1668 +#: ../../library/sqlite3.rst:1660 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1703 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:1713 +#: ../../library/sqlite3.rst:1705 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -1513,11 +1513,11 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:1754 +#: ../../library/sqlite3.rst:1746 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:1756 +#: ../../library/sqlite3.rst:1748 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -1527,61 +1527,61 @@ msgid "" "exception, the transaction is rolled back." msgstr "" -#: ../../library/sqlite3.rst:1765 +#: ../../library/sqlite3.rst:1757 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, the context manager is a no-op." msgstr "" -#: ../../library/sqlite3.rst:1770 +#: ../../library/sqlite3.rst:1762 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection." msgstr "" -#: ../../library/sqlite3.rst:1803 +#: ../../library/sqlite3.rst:1795 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:1805 +#: ../../library/sqlite3.rst:1797 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:1807 +#: ../../library/sqlite3.rst:1799 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:1816 +#: ../../library/sqlite3.rst:1808 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:1826 +#: ../../library/sqlite3.rst:1818 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:1840 +#: ../../library/sqlite3.rst:1832 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:1849 +#: ../../library/sqlite3.rst:1841 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:1854 +#: ../../library/sqlite3.rst:1846 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:1856 +#: ../../library/sqlite3.rst:1848 msgid "" "The :mod:`!sqlite3` module does not adhere to the transaction handling " "recommended by :pep:`249`." msgstr "" -#: ../../library/sqlite3.rst:1859 +#: ../../library/sqlite3.rst:1851 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -1594,7 +1594,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:1871 +#: ../../library/sqlite3.rst:1863 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -1604,14 +1604,14 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:1879 +#: ../../library/sqlite3.rst:1871 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:1883 +#: ../../library/sqlite3.rst:1875 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." diff --git a/library/stdtypes.po b/library/stdtypes.po index 702d391dc80..43d2f02bb23 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-31 00:21+0000\n" +"POT-Creation-Date: 2022-09-05 00:20+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -5805,47 +5805,253 @@ msgid "" "in definition order. Example::" msgstr "" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5413 +msgid "Integer string conversion length limitation" +msgstr "" + +#: ../../library/stdtypes.rst:5415 +msgid "" +"CPython has a global limit for converting between :class:`int` and :class:" +"`str` to mitigate denial of service attacks. This limit *only* applies to " +"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " +"binary conversions are unlimited. The limit can be configured." +msgstr "" + +#: ../../library/stdtypes.rst:5420 +msgid "" +"The :class:`int` type in CPython is an abitrary length number stored in " +"binary form (commonly known as a \"bignum\"). There exists no algorithm that " +"can convert a string to a binary integer or a binary integer to a string in " +"linear time, *unless* the base is a power of 2. Even the best known " +"algorithms for base 10 have sub-quadratic complexity. Converting a large " +"value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." +msgstr "" + +#: ../../library/stdtypes.rst:5427 +msgid "" +"Limiting conversion size offers a practical way to avoid `CVE-2020-10735 " +"`_." +msgstr "" + +#: ../../library/stdtypes.rst:5430 +msgid "" +"The limit is applied to the number of digit characters in the input or " +"output string when a non-linear conversion algorithm would be involved. " +"Underscores and the sign are not counted towards the limit." +msgstr "" + +#: ../../library/stdtypes.rst:5434 +msgid "" +"When an operation would exceed the limit, a :exc:`ValueError` is raised:" +msgstr "" + +#: ../../library/stdtypes.rst:5456 +msgid "" +"The default limit is 4300 digits as provided in :data:`sys.int_info." +"default_max_str_digits `. The lowest limit that can be " +"configured is 640 digits as provided in :data:`sys.int_info." +"str_digits_check_threshold `." +msgstr "" + +#: ../../library/stdtypes.rst:5461 +msgid "Verification:" +msgstr "" + +#: ../../library/stdtypes.rst:5476 +msgid "Affected APIs" +msgstr "" + +#: ../../library/stdtypes.rst:5478 +msgid "" +"The limitation only applies to potentially slow conversions between :class:" +"`int` and :class:`str` or :class:`bytes`:" +msgstr "" + +#: ../../library/stdtypes.rst:5481 +msgid "``int(string)`` with default base 10." +msgstr "" + +#: ../../library/stdtypes.rst:5482 +msgid "``int(string, base)`` for all bases that are not a power of 2." +msgstr "" + +#: ../../library/stdtypes.rst:5483 +msgid "``str(integer)``." +msgstr "``str(integer)``。" + +#: ../../library/stdtypes.rst:5484 +msgid "``repr(integer)``" +msgstr "``repr(integer)``" + +#: ../../library/stdtypes.rst:5485 +msgid "" +"any other string conversion to base 10, for example ``f\"{integer}\"``, ``" +"\"{}\".format(integer)``, or ``b\"%d\" % integer``." +msgstr "" + +#: ../../library/stdtypes.rst:5488 +msgid "The limitations do not apply to functions with a linear algorithm:" +msgstr "" + +#: ../../library/stdtypes.rst:5490 +msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." +msgstr "" + +#: ../../library/stdtypes.rst:5491 +msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." +msgstr "" + +#: ../../library/stdtypes.rst:5492 +msgid ":func:`hex`, :func:`oct`, :func:`bin`." +msgstr "" + +#: ../../library/stdtypes.rst:5493 +msgid ":ref:`formatspec` for hex, octal, and binary numbers." +msgstr "" + +#: ../../library/stdtypes.rst:5494 +msgid ":class:`str` to :class:`float`." +msgstr "" + +#: ../../library/stdtypes.rst:5495 +msgid ":class:`str` to :class:`decimal.Decimal`." +msgstr "" + +#: ../../library/stdtypes.rst:5498 +msgid "Configuring the limit" +msgstr "" + +#: ../../library/stdtypes.rst:5500 +msgid "" +"Before Python starts up you can use an environment variable or an " +"interpreter command line flag to configure the limit:" +msgstr "" + +#: ../../library/stdtypes.rst:5503 +msgid "" +":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " +"to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " +"the limitation." +msgstr "" + +#: ../../library/stdtypes.rst:5506 +msgid "" +":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " +"int_max_str_digits=640``" +msgstr "" + +#: ../../library/stdtypes.rst:5508 +msgid "" +":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" +"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " +"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " +"value of *-1* indicates that both were unset, thus a value of :data:`sys." +"int_info.default_max_str_digits` was used during initilization." +msgstr "" + +#: ../../library/stdtypes.rst:5514 +msgid "" +"From code, you can inspect the current limit and set a new one using these :" +"mod:`sys` APIs:" +msgstr "" + +#: ../../library/stdtypes.rst:5517 +msgid "" +":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " +"are a getter and setter for the interpreter-wide limit. Subinterpreters have " +"their own limit." +msgstr "" + +#: ../../library/stdtypes.rst:5521 +msgid "" +"Information about the default and minimum can be found in :attr:`sys." +"int_info`:" +msgstr "" + +#: ../../library/stdtypes.rst:5523 +msgid "" +":data:`sys.int_info.default_max_str_digits ` is the compiled-" +"in default limit." +msgstr "" + +#: ../../library/stdtypes.rst:5525 +msgid "" +":data:`sys.int_info.str_digits_check_threshold ` is the lowest " +"accepted value for the limit (other than 0 which disables it)." +msgstr "" + +#: ../../library/stdtypes.rst:5532 +msgid "" +"Setting a low limit *can* lead to problems. While rare, code exists that " +"contains integer constants in decimal in their source that exceed the " +"minimum threshold. A consequence of setting the limit is that Python source " +"code containing decimal integer literals longer than the limit will " +"encounter an error during parsing, usually at startup time or import time or " +"even at installation time - anytime an up to date ``.pyc`` does not already " +"exist for the code. A workaround for source that contains such large " +"constants is to convert them to ``0x`` hexadecimal form as it has no limit." +msgstr "" + +#: ../../library/stdtypes.rst:5541 +msgid "" +"Test your application thoroughly if you use a low limit. Ensure your tests " +"run with the limit set early via the environment or flag so that it applies " +"during startup and even during any installation step that may invoke Python " +"to precompile ``.py`` sources to ``.pyc`` files." +msgstr "" + +#: ../../library/stdtypes.rst:5547 +msgid "Recommended configuration" +msgstr "" + +#: ../../library/stdtypes.rst:5549 +msgid "" +"The default :data:`sys.int_info.default_max_str_digits` is expected to be " +"reasonable for most applications. If your application requires a different " +"limit, set it from your main entry point using Python version agnostic code " +"as these APIs were added in security patch releases in versions before 3.11." +msgstr "" + +#: ../../library/stdtypes.rst:5554 +msgid "Example::" +msgstr "" +"範例:\n" +"\n" +"::" + +#: ../../library/stdtypes.rst:5566 +msgid "If you need to disable it entirely, set it to ``0``." +msgstr "" + +#: ../../library/stdtypes.rst:5570 msgid "Footnotes" msgstr "註解" -#: ../../library/stdtypes.rst:5412 +#: ../../library/stdtypes.rst:5571 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5415 +#: ../../library/stdtypes.rst:5574 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5577 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5420 +#: ../../library/stdtypes.rst:5579 msgid "" "Cased characters are those with general category property being one of \"Lu" "\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5582 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." msgstr "" - -#~ msgid ":class:`pathlib.Path`" -#~ msgstr ":class:`pathlib.Path`" - -#~ msgid ":class:`pathlib.PurePath`" -#~ msgstr ":class:`pathlib.PurePath`" - -#~ msgid ":class:`pathlib.PurePosixPath`" -#~ msgstr ":class:`pathlib.PurePosixPath`" - -#~ msgid ":class:`pathlib.PureWindowsPath`" -#~ msgstr ":class:`pathlib.PureWindowsPath`" diff --git a/library/sys.po b/library/sys.po index a96d9ac46eb..9d7a1d4fc17 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -334,8 +334,8 @@ msgstr "" msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:269 ../../library/sys.rst:808 -#: ../../library/sys.rst:1487 ../../library/sys.rst:1717 +#: ../../library/sys.rst:269 ../../library/sys.rst:819 +#: ../../library/sys.rst:1518 ../../library/sys.rst:1748 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" @@ -548,8 +548,8 @@ msgid "" "The attributes are read only." msgstr "" -#: ../../library/sys.rst:464 ../../library/sys.rst:513 -#: ../../library/sys.rst:853 +#: ../../library/sys.rst:464 ../../library/sys.rst:517 +#: ../../library/sys.rst:864 msgid "attribute" msgstr "" @@ -673,30 +673,44 @@ msgstr ":const:`utf8_mode`" msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:483 +#: ../../library/sys.rst:481 +msgid ":const:`int_max_str_digits`" +msgstr ":const:`int_max_str_digits`" + +#: ../../library/sys.rst:481 +msgid "" +":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " +"limitation `)" +msgstr "" + +#: ../../library/sys.rst:484 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "" -#: ../../library/sys.rst:486 +#: ../../library/sys.rst:487 msgid "The ``hash_randomization`` attribute." msgstr "" -#: ../../library/sys.rst:489 +#: ../../library/sys.rst:490 msgid "Removed obsolete ``division_warning`` attribute." msgstr "" -#: ../../library/sys.rst:492 +#: ../../library/sys.rst:493 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "" -#: ../../library/sys.rst:495 +#: ../../library/sys.rst:496 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: ../../library/sys.rst:503 +#: ../../library/sys.rst:501 +msgid "Added the ``int_max_str_digits`` attribute." +msgstr "" + +#: ../../library/sys.rst:507 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -706,163 +720,163 @@ msgid "" "floating types', for details." msgstr "" -#: ../../library/sys.rst:513 +#: ../../library/sys.rst:517 msgid "float.h macro" msgstr "" -#: ../../library/sys.rst:513 ../../library/sys.rst:853 +#: ../../library/sys.rst:517 ../../library/sys.rst:864 msgid "explanation" msgstr "" -#: ../../library/sys.rst:515 +#: ../../library/sys.rst:519 msgid ":const:`epsilon`" msgstr ":const:`epsilon`" -#: ../../library/sys.rst:515 +#: ../../library/sys.rst:519 msgid "DBL_EPSILON" msgstr "DBL_EPSILON" -#: ../../library/sys.rst:515 +#: ../../library/sys.rst:519 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float" msgstr "" -#: ../../library/sys.rst:518 +#: ../../library/sys.rst:522 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`\\ 。" -#: ../../library/sys.rst:520 +#: ../../library/sys.rst:524 msgid ":const:`dig`" msgstr ":const:`dig`" -#: ../../library/sys.rst:520 +#: ../../library/sys.rst:524 msgid "DBL_DIG" msgstr "DBL_DIG" -#: ../../library/sys.rst:520 +#: ../../library/sys.rst:524 msgid "" "maximum number of decimal digits that can be faithfully represented in a " "float; see below" msgstr "" -#: ../../library/sys.rst:523 +#: ../../library/sys.rst:527 msgid ":const:`mant_dig`" msgstr ":const:`mant_dig`" -#: ../../library/sys.rst:523 +#: ../../library/sys.rst:527 msgid "DBL_MANT_DIG" msgstr "DBL_MANT_DIG" -#: ../../library/sys.rst:523 +#: ../../library/sys.rst:527 msgid "" "float precision: the number of base-``radix`` digits in the significand of a " "float" msgstr "" -#: ../../library/sys.rst:526 +#: ../../library/sys.rst:530 msgid ":const:`max`" msgstr ":const:`max`" -#: ../../library/sys.rst:526 +#: ../../library/sys.rst:530 msgid "DBL_MAX" msgstr "DBL_MAX" -#: ../../library/sys.rst:526 +#: ../../library/sys.rst:530 msgid "maximum representable positive finite float" msgstr "" -#: ../../library/sys.rst:528 +#: ../../library/sys.rst:532 msgid ":const:`max_exp`" msgstr ":const:`max_exp`" -#: ../../library/sys.rst:528 +#: ../../library/sys.rst:532 msgid "DBL_MAX_EXP" msgstr "DBL_MAX_EXP" -#: ../../library/sys.rst:528 +#: ../../library/sys.rst:532 msgid "" "maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float" msgstr "" -#: ../../library/sys.rst:531 +#: ../../library/sys.rst:535 msgid ":const:`max_10_exp`" msgstr ":const:`max_10_exp`" -#: ../../library/sys.rst:531 +#: ../../library/sys.rst:535 msgid "DBL_MAX_10_EXP" msgstr "DBL_MAX_10_EXP" -#: ../../library/sys.rst:531 +#: ../../library/sys.rst:535 msgid "" "maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats" msgstr "" -#: ../../library/sys.rst:534 +#: ../../library/sys.rst:538 msgid ":const:`min`" msgstr ":const:`min`" -#: ../../library/sys.rst:534 +#: ../../library/sys.rst:538 msgid "DBL_MIN" msgstr "DBL_MIN" -#: ../../library/sys.rst:534 +#: ../../library/sys.rst:538 msgid "minimum representable positive *normalized* float" msgstr "" -#: ../../library/sys.rst:536 +#: ../../library/sys.rst:540 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:544 msgid ":const:`min_exp`" msgstr ":const:`min_exp`" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:544 msgid "DBL_MIN_EXP" msgstr "DBL_MIN_EXP" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:544 msgid "minimum integer *e* such that ``radix**(e-1)`` is a normalized float" msgstr "" -#: ../../library/sys.rst:543 +#: ../../library/sys.rst:547 msgid ":const:`min_10_exp`" msgstr ":const:`min_10_exp`" -#: ../../library/sys.rst:543 +#: ../../library/sys.rst:547 msgid "DBL_MIN_10_EXP" msgstr "DBL_MIN_10_EXP" -#: ../../library/sys.rst:543 +#: ../../library/sys.rst:547 msgid "minimum integer *e* such that ``10**e`` is a normalized float" msgstr "" -#: ../../library/sys.rst:546 +#: ../../library/sys.rst:550 msgid ":const:`radix`" msgstr ":const:`radix`" -#: ../../library/sys.rst:546 +#: ../../library/sys.rst:550 msgid "FLT_RADIX" msgstr "FLT_RADIX" -#: ../../library/sys.rst:546 +#: ../../library/sys.rst:550 msgid "radix of exponent representation" msgstr "" -#: ../../library/sys.rst:548 +#: ../../library/sys.rst:552 msgid ":const:`rounds`" msgstr ":const:`rounds`" -#: ../../library/sys.rst:548 +#: ../../library/sys.rst:552 msgid "FLT_ROUNDS" msgstr "FLT_ROUNDS" -#: ../../library/sys.rst:548 +#: ../../library/sys.rst:552 msgid "" "integer constant representing the rounding mode used for arithmetic " "operations. This reflects the value of the system FLT_ROUNDS macro at " @@ -870,7 +884,7 @@ msgid "" "explanation of the possible values and their meanings." msgstr "" -#: ../../library/sys.rst:556 +#: ../../library/sys.rst:560 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." @@ -878,13 +892,13 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:569 +#: ../../library/sys.rst:573 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: ../../library/sys.rst:578 +#: ../../library/sys.rst:582 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -894,7 +908,7 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: ../../library/sys.rst:591 +#: ../../library/sys.rst:595 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " @@ -904,38 +918,38 @@ msgid "" "results." msgstr "" -#: ../../library/sys.rst:598 +#: ../../library/sys.rst:602 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks()` is allowed to return 0 instead." msgstr "" -#: ../../library/sys.rst:606 +#: ../../library/sys.rst:610 msgid "Return the build time API version of Android as an integer." msgstr "" -#: ../../library/sys.rst:609 +#: ../../library/sys.rst:613 msgid ":ref:`Availability `: Android." msgstr ":ref:`適用 `:Android。" -#: ../../library/sys.rst:615 +#: ../../library/sys.rst:619 msgid "" "Return the name of the current default string encoding used by the Unicode " "implementation." msgstr "" -#: ../../library/sys.rst:621 +#: ../../library/sys.rst:625 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (``RTLD_xxx`` constants, e.g. :data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:626 ../../library/sys.rst:1256 +#: ../../library/sys.rst:630 ../../library/sys.rst:1279 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/sys.rst:631 +#: ../../library/sys.rst:635 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` is enabled." msgstr "" -#: ../../library/sys.rst:664 +#: ../../library/sys.rst:668 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -990,14 +1004,20 @@ msgid "" "func:`getfilesystemencoding`." msgstr "" -#: ../../library/sys.rst:682 +#: ../../library/sys.rst:686 +msgid "" +"Returns the current value for the :ref:`integer string conversion length " +"limitation `. See also :func:`set_int_max_str_digits`." +msgstr "" + +#: ../../library/sys.rst:693 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: ../../library/sys.rst:689 +#: ../../library/sys.rst:700 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " @@ -1005,46 +1025,46 @@ msgid "" "func:`setrecursionlimit`." msgstr "" -#: ../../library/sys.rst:697 +#: ../../library/sys.rst:708 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: ../../library/sys.rst:702 +#: ../../library/sys.rst:713 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: ../../library/sys.rst:705 +#: ../../library/sys.rst:716 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: ../../library/sys.rst:708 +#: ../../library/sys.rst:719 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: ../../library/sys.rst:712 +#: ../../library/sys.rst:723 msgid "" "See `recursive sizeof recipe `_ " "for an example of using :func:`getsizeof` recursively to find the size of " "containers and all their contents." msgstr "" -#: ../../library/sys.rst:718 +#: ../../library/sys.rst:729 msgid "" "Return the interpreter's \"thread switch interval\"; see :func:" "`setswitchinterval`." msgstr "" -#: ../../library/sys.rst:726 +#: ../../library/sys.rst:737 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1053,27 +1073,27 @@ msgid "" "stack." msgstr "" -#: ../../library/sys.rst:731 +#: ../../library/sys.rst:742 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:735 +#: ../../library/sys.rst:746 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:745 +#: ../../library/sys.rst:756 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:754 +#: ../../library/sys.rst:765 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:758 +#: ../../library/sys.rst:769 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1081,7 +1101,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:766 +#: ../../library/sys.rst:777 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1093,54 +1113,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:777 +#: ../../library/sys.rst:788 msgid "*platform* will be :const:`2 (VER_PLATFORM_WIN32_NT)`." msgstr "" -#: ../../library/sys.rst:779 +#: ../../library/sys.rst:790 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:782 +#: ../../library/sys.rst:793 msgid "Constant" msgstr "" -#: ../../library/sys.rst:782 +#: ../../library/sys.rst:793 msgid "Meaning" msgstr "" -#: ../../library/sys.rst:784 +#: ../../library/sys.rst:795 msgid ":const:`1 (VER_NT_WORKSTATION)`" msgstr ":const:`1 (VER_NT_WORKSTATION)`" -#: ../../library/sys.rst:784 +#: ../../library/sys.rst:795 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:786 +#: ../../library/sys.rst:797 msgid ":const:`2 (VER_NT_DOMAIN_CONTROLLER)`" msgstr ":const:`2 (VER_NT_DOMAIN_CONTROLLER)`" -#: ../../library/sys.rst:786 +#: ../../library/sys.rst:797 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:789 +#: ../../library/sys.rst:800 msgid ":const:`3 (VER_NT_SERVER)`" msgstr ":const:`3 (VER_NT_SERVER)`" -#: ../../library/sys.rst:789 +#: ../../library/sys.rst:800 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:793 +#: ../../library/sys.rst:804 msgid "" "This function wraps the Win32 :c:func:`GetVersionEx` function; see the " "Microsoft documentation on :c:func:`OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:797 +#: ../../library/sys.rst:808 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1148,24 +1168,24 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:803 +#: ../../library/sys.rst:814 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:809 +#: ../../library/sys.rst:820 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:813 +#: ../../library/sys.rst:824 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:819 +#: ../../library/sys.rst:830 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form `(firstiter, finalizer)`, where " @@ -1175,103 +1195,103 @@ msgid "" "loop." msgstr "" -#: ../../library/sys.rst:826 +#: ../../library/sys.rst:837 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`\\ 。" -#: ../../library/sys.rst:830 ../../library/sys.rst:1450 +#: ../../library/sys.rst:841 ../../library/sys.rst:1481 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:836 +#: ../../library/sys.rst:847 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:842 ../../library/sys.rst:1471 +#: ../../library/sys.rst:853 ../../library/sys.rst:1502 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:848 +#: ../../library/sys.rst:859 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:855 +#: ../../library/sys.rst:866 msgid ":const:`width`" msgstr ":const:`width`" -#: ../../library/sys.rst:855 +#: ../../library/sys.rst:866 msgid "width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:857 +#: ../../library/sys.rst:868 msgid ":const:`modulus`" msgstr ":const:`modulus`" -#: ../../library/sys.rst:857 +#: ../../library/sys.rst:868 msgid "prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:859 +#: ../../library/sys.rst:870 msgid ":const:`inf`" msgstr ":const:`inf`" -#: ../../library/sys.rst:859 +#: ../../library/sys.rst:870 msgid "hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:861 +#: ../../library/sys.rst:872 msgid ":const:`nan`" msgstr ":const:`nan`" -#: ../../library/sys.rst:861 +#: ../../library/sys.rst:872 msgid "(this attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:863 +#: ../../library/sys.rst:874 msgid ":const:`imag`" msgstr ":const:`imag`" -#: ../../library/sys.rst:863 +#: ../../library/sys.rst:874 msgid "multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:866 +#: ../../library/sys.rst:877 msgid ":const:`algorithm`" msgstr ":const:`algorithm`" -#: ../../library/sys.rst:866 +#: ../../library/sys.rst:877 msgid "name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:869 +#: ../../library/sys.rst:880 msgid ":const:`hash_bits`" msgstr ":const:`hash_bits`" -#: ../../library/sys.rst:869 +#: ../../library/sys.rst:880 msgid "internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:871 +#: ../../library/sys.rst:882 msgid ":const:`seed_bits`" msgstr ":const:`seed_bits`" -#: ../../library/sys.rst:871 +#: ../../library/sys.rst:882 msgid "size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:877 +#: ../../library/sys.rst:888 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*\\ 、\\ *hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:883 +#: ../../library/sys.rst:894 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1279,7 +1299,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:894 +#: ../../library/sys.rst:905 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. " @@ -1287,25 +1307,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:899 +#: ../../library/sys.rst:910 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:904 +#: ../../library/sys.rst:915 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:908 +#: ../../library/sys.rst:919 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:912 +#: ../../library/sys.rst:923 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 " @@ -1317,13 +1337,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:922 +#: ../../library/sys.rst:933 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:925 +#: ../../library/sys.rst:936 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 " @@ -1332,7 +1352,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:932 +#: ../../library/sys.rst:943 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1342,45 +1362,69 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:943 +#: ../../library/sys.rst:954 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:948 +#: ../../library/sys.rst:959 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:954 ../../library/sys.rst:1602 +#: ../../library/sys.rst:965 ../../library/sys.rst:1633 msgid "Attribute" msgstr "屬性" -#: ../../library/sys.rst:954 ../../library/sys.rst:1602 +#: ../../library/sys.rst:965 ../../library/sys.rst:1633 msgid "Explanation" msgstr "解釋" -#: ../../library/sys.rst:956 +#: ../../library/sys.rst:967 msgid ":const:`bits_per_digit`" msgstr ":const:`bits_per_digit`" -#: ../../library/sys.rst:956 +#: ../../library/sys.rst:967 msgid "" "number of bits held in each digit. Python integers are stored internally in " "base ``2**int_info.bits_per_digit``" msgstr "" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:971 msgid ":const:`sizeof_digit`" msgstr ":const:`sizeof_digit`" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:971 msgid "size in bytes of the C type used to represent a digit" msgstr "" -#: ../../library/sys.rst:969 +#: ../../library/sys.rst:974 +msgid ":const:`default_max_str_digits`" +msgstr ":const:`default_max_str_digits`" + +#: ../../library/sys.rst:974 +msgid "" +"default value for :func:`sys.get_int_max_str_digits` when it is not " +"otherwise explicitly configured." +msgstr "" + +#: ../../library/sys.rst:978 +msgid ":const:`str_digits_check_threshold`" +msgstr ":const:`str_digits_check_threshold`" + +#: ../../library/sys.rst:978 +msgid "" +"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:986 +msgid "Added ``default_max_str_digits`` and ``str_digits_check_threshold``." +msgstr "新增 ``default_max_str_digits`` 和 ``str_digits_check_threshold``。" + +#: ../../library/sys.rst:992 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:975 +#: ../../library/sys.rst:998 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with argument ``hook``." msgstr "" -#: ../../library/sys.rst:977 +#: ../../library/sys.rst:1000 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:986 +#: ../../library/sys.rst:1009 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 " @@ -1413,19 +1457,19 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:994 +#: ../../library/sys.rst:1017 msgid "" "Interned strings are not immortal; you must keep a reference to the return " "value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1000 +#: ../../library/sys.rst:1023 msgid "" "Return :const:`True` if the Python interpreter is :term:`shutting down " "`, :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1010 +#: ../../library/sys.rst:1033 msgid "" "These three variables are not always defined; they are set when an exception " "is not handled and the interpreter prints an error message and a stack " @@ -1436,33 +1480,33 @@ msgid "" "information.)" msgstr "" -#: ../../library/sys.rst:1018 +#: ../../library/sys.rst:1041 msgid "" "The meaning of the variables is the same as that of the return values from :" "func:`exc_info` above." msgstr "" -#: ../../library/sys.rst:1024 +#: ../../library/sys.rst:1047 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:1031 +#: ../../library/sys.rst:1054 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1034 +#: ../../library/sys.rst:1057 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:1042 +#: ../../library/sys.rst:1065 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 " @@ -1475,27 +1519,27 @@ msgid "" "if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1055 +#: ../../library/sys.rst:1078 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1055 +#: ../../library/sys.rst:1078 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1059 +#: ../../library/sys.rst:1082 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1058 +#: ../../library/sys.rst:1081 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1064 +#: ../../library/sys.rst:1087 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`. Earlier versions of Python looked for a method called :meth:" @@ -1504,7 +1548,7 @@ msgid "" "MetaPathFinder.find_spec` method." msgstr "" -#: ../../library/sys.rst:1072 +#: ../../library/sys.rst:1095 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 " @@ -1516,24 +1560,24 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1084 +#: ../../library/sys.rst:1107 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1087 +#: ../../library/sys.rst:1110 msgid "See also :data:`sys.argv`." msgstr "另請參閱 :data:`sys.argv`\\ 。" -#: ../../library/sys.rst:1096 +#: ../../library/sys.rst:1119 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:1100 +#: ../../library/sys.rst:1123 msgid "" "As initialized upon program startup, the first item of this list, " "``path[0]``, is the directory containing the script that was used to invoke " @@ -1545,31 +1589,31 @@ msgid "" "`PYTHONPATH`." msgstr "" -#: ../../library/sys.rst:1108 +#: ../../library/sys.rst:1131 msgid "" "A program is free to modify this list for its own purposes. Only strings " "and bytes should be added to :data:`sys.path`; all other data types are " "ignored during import." msgstr "" -#: ../../library/sys.rst:1114 +#: ../../library/sys.rst:1137 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1120 +#: ../../library/sys.rst:1143 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`." msgstr "" -#: ../../library/sys.rst:1124 ../../library/sys.rst:1135 +#: ../../library/sys.rst:1147 ../../library/sys.rst:1158 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1129 +#: ../../library/sys.rst:1152 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 " @@ -1577,19 +1621,19 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1137 +#: ../../library/sys.rst:1160 msgid "" "``None`` is stored instead of :class:`imp.NullImporter` when no finder is " "found." msgstr "" -#: ../../library/sys.rst:1144 +#: ../../library/sys.rst:1167 msgid "" "This string contains a platform identifier that can be used to append " "platform-specific components to :data:`sys.path`, for instance." msgstr "" -#: ../../library/sys.rst:1147 +#: ../../library/sys.rst:1170 msgid "" "For Unix systems, except on Linux and AIX, this is the lowercased OS name as " "returned by ``uname -s`` with the first part of the version as returned by " @@ -1598,59 +1642,59 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1160 +#: ../../library/sys.rst:1183 msgid "For other systems, the values are:" msgstr "" -#: ../../library/sys.rst:1163 +#: ../../library/sys.rst:1186 msgid "System" msgstr "" -#: ../../library/sys.rst:1163 +#: ../../library/sys.rst:1186 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1165 +#: ../../library/sys.rst:1188 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1165 +#: ../../library/sys.rst:1188 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1166 +#: ../../library/sys.rst:1189 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1166 +#: ../../library/sys.rst:1189 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1167 +#: ../../library/sys.rst:1190 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1167 +#: ../../library/sys.rst:1190 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1168 +#: ../../library/sys.rst:1191 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1168 +#: ../../library/sys.rst:1191 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1169 +#: ../../library/sys.rst:1192 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1169 +#: ../../library/sys.rst:1192 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1172 +#: ../../library/sys.rst:1195 msgid "" "On Linux, :attr:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since older " @@ -1658,7 +1702,7 @@ msgid "" "the ``startswith`` idiom presented above." msgstr "" -#: ../../library/sys.rst:1178 +#: ../../library/sys.rst:1201 msgid "" "On AIX, :attr:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since older " @@ -1666,57 +1710,57 @@ msgid "" "the ``startswith`` idiom presented above." msgstr "" -#: ../../library/sys.rst:1186 +#: ../../library/sys.rst:1209 msgid "" ":attr:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1189 +#: ../../library/sys.rst:1212 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1195 +#: ../../library/sys.rst:1218 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:1198 +#: ../../library/sys.rst:1221 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):" msgstr "" -#: ../../library/sys.rst:1202 +#: ../../library/sys.rst:1225 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1204 +#: ../../library/sys.rst:1227 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:1207 +#: ../../library/sys.rst:1230 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1209 +#: ../../library/sys.rst:1232 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1217 +#: ../../library/sys.rst:1240 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is ``'/usr/" @@ -1725,14 +1769,14 @@ msgid "" "paths." msgstr "" -#: ../../library/sys.rst:1223 +#: ../../library/sys.rst:1246 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1238 +#: ../../library/sys.rst:1261 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1742,7 +1786,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1248 +#: ../../library/sys.rst:1271 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 " @@ -1753,7 +1797,14 @@ msgid "" "data:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1264 +#: ../../library/sys.rst:1283 +msgid "" +"Set the :ref:`integer string conversion length limitation " +"` used by this interpreter. See also :func:" +"`get_int_max_str_digits`." +msgstr "" + +#: ../../library/sys.rst:1295 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 " @@ -1768,7 +1819,7 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1275 +#: ../../library/sys.rst:1306 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1776,71 +1827,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1280 +#: ../../library/sys.rst:1311 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1282 ../../library/sys.rst:1363 +#: ../../library/sys.rst:1313 ../../library/sys.rst:1394 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1286 ../../library/sys.rst:1368 +#: ../../library/sys.rst:1317 ../../library/sys.rst:1399 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1285 +#: ../../library/sys.rst:1316 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1291 ../../library/sys.rst:1383 +#: ../../library/sys.rst:1322 ../../library/sys.rst:1414 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1289 +#: ../../library/sys.rst:1320 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:1295 +#: ../../library/sys.rst:1326 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1325 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:1298 +#: ../../library/sys.rst:1329 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1298 +#: ../../library/sys.rst:1329 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1331 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1301 +#: ../../library/sys.rst:1332 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1305 +#: ../../library/sys.rst:1336 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:1309 +#: ../../library/sys.rst:1340 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 " @@ -1848,19 +1899,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1345 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1317 +#: ../../library/sys.rst:1348 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1324 +#: ../../library/sys.rst:1355 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -1871,7 +1922,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1341 +#: ../../library/sys.rst:1372 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 " @@ -1880,7 +1931,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1346 +#: ../../library/sys.rst:1377 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1888,7 +1939,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1351 +#: ../../library/sys.rst:1382 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 " @@ -1896,31 +1947,31 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1356 +#: ../../library/sys.rst:1387 msgid "" "The local trace function should return a reference to itself (or to another " "function for further tracing in that scope), or ``None`` to turn off tracing " "in that scope." msgstr "" -#: ../../library/sys.rst:1360 +#: ../../library/sys.rst:1391 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:1366 +#: ../../library/sys.rst:1397 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:1377 +#: ../../library/sys.rst:1408 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1402 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``; " @@ -1930,7 +1981,7 @@ msgid "" "const:`False` on that frame." msgstr "" -#: ../../library/sys.rst:1380 +#: ../../library/sys.rst:1411 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 " @@ -1938,22 +1989,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1388 +#: ../../library/sys.rst:1419 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1386 +#: ../../library/sys.rst:1417 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:1396 +#: ../../library/sys.rst:1427 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1391 +#: ../../library/sys.rst:1422 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 " @@ -1962,13 +2013,13 @@ msgid "" "`f_trace_opcodes` to :const:`True` on the frame." msgstr "" -#: ../../library/sys.rst:1398 +#: ../../library/sys.rst:1429 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:1401 +#: ../../library/sys.rst:1432 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 " @@ -1982,17 +2033,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1412 +#: ../../library/sys.rst:1443 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1414 +#: ../../library/sys.rst:1445 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1449 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2000,13 +2051,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1425 +#: ../../library/sys.rst:1456 msgid "" "``'opcode'`` event type added; :attr:`f_trace_lines` and :attr:" "`f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1430 +#: ../../library/sys.rst:1461 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2015,32 +2066,32 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1436 +#: ../../library/sys.rst:1467 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -#: ../../library/sys.rst:1438 +#: ../../library/sys.rst:1469 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -#: ../../library/sys.rst:1440 +#: ../../library/sys.rst:1471 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:1443 +#: ../../library/sys.rst:1474 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`" msgstr "" -#: ../../library/sys.rst:1455 +#: ../../library/sys.rst:1486 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2049,74 +2100,74 @@ msgid "" "disabled, ``cr_origin`` will be None." msgstr "" -#: ../../library/sys.rst:1462 +#: ../../library/sys.rst:1493 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1497 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1476 +#: ../../library/sys.rst:1507 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:1480 +#: ../../library/sys.rst:1511 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1483 +#: ../../library/sys.rst:1514 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1488 +#: ../../library/sys.rst:1519 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`\\ 。" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1526 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1498 +#: ../../library/sys.rst:1529 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1500 +#: ../../library/sys.rst:1531 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:1502 +#: ../../library/sys.rst:1533 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1504 +#: ../../library/sys.rst:1535 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:1508 +#: ../../library/sys.rst:1539 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1542 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 " @@ -2127,14 +2178,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1520 +#: ../../library/sys.rst:1551 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:1525 +#: ../../library/sys.rst:1556 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2143,7 +2194,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1532 +#: ../../library/sys.rst:1563 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2152,19 +2203,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1538 +#: ../../library/sys.rst:1569 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1544 +#: ../../library/sys.rst:1575 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:1548 +#: ../../library/sys.rst:1579 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 " @@ -2172,7 +2223,7 @@ msgid "" "support the :attr:`~io.BufferedIOBase.buffer` attribute." msgstr "" -#: ../../library/sys.rst:1558 +#: ../../library/sys.rst:1589 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2180,7 +2231,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1594 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, " @@ -2188,7 +2239,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1569 +#: ../../library/sys.rst:1600 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2196,12 +2247,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1577 +#: ../../library/sys.rst:1608 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1579 +#: ../../library/sys.rst:1610 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 " @@ -2209,7 +2260,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1584 +#: ../../library/sys.rst:1615 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 " @@ -2217,66 +2268,66 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1589 +#: ../../library/sys.rst:1620 msgid "See also the :attr:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1596 +#: ../../library/sys.rst:1627 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1604 +#: ../../library/sys.rst:1635 msgid ":const:`name`" msgstr ":const:`name`" -#: ../../library/sys.rst:1604 +#: ../../library/sys.rst:1635 msgid "Name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1606 +#: ../../library/sys.rst:1637 msgid "``'nt'``: Windows threads" msgstr "" -#: ../../library/sys.rst:1607 +#: ../../library/sys.rst:1638 msgid "``'pthread'``: POSIX threads" msgstr "" -#: ../../library/sys.rst:1608 +#: ../../library/sys.rst:1639 msgid "``'solaris'``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1610 +#: ../../library/sys.rst:1641 msgid ":const:`lock`" msgstr ":const:`lock`" -#: ../../library/sys.rst:1610 +#: ../../library/sys.rst:1641 msgid "Name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1612 +#: ../../library/sys.rst:1643 msgid "``'semaphore'``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1613 +#: ../../library/sys.rst:1644 msgid "``'mutex+cond'``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1615 +#: ../../library/sys.rst:1646 msgid "``None`` if this information is unknown" msgstr "" -#: ../../library/sys.rst:1617 +#: ../../library/sys.rst:1648 msgid ":const:`version`" msgstr ":const:`version`" -#: ../../library/sys.rst:1617 +#: ../../library/sys.rst:1648 msgid "" "Name and version of the thread library. It is a string, or ``None`` if this " "information is unknown." msgstr "" -#: ../../library/sys.rst:1626 +#: ../../library/sys.rst:1657 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2285,78 +2336,78 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1634 +#: ../../library/sys.rst:1665 msgid "Handle an unraisable exception." msgstr "" -#: ../../library/sys.rst:1636 +#: ../../library/sys.rst:1667 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:1640 +#: ../../library/sys.rst:1671 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1642 +#: ../../library/sys.rst:1673 msgid "*exc_type*: Exception type." msgstr "" -#: ../../library/sys.rst:1643 +#: ../../library/sys.rst:1674 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: ../../library/sys.rst:1644 +#: ../../library/sys.rst:1675 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: ../../library/sys.rst:1645 +#: ../../library/sys.rst:1676 msgid "*err_msg*: Error message, can be ``None``." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1677 msgid "*object*: Object causing the exception, can be ``None``." msgstr "" -#: ../../library/sys.rst:1648 +#: ../../library/sys.rst:1679 msgid "" "The default hook formats *err_msg* and *object* as: ``f'{err_msg}: {object!" "r}'``; use \"Exception ignored in\" error message if *err_msg* is ``None``." msgstr "" -#: ../../library/sys.rst:1652 +#: ../../library/sys.rst:1683 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1655 +#: ../../library/sys.rst:1686 msgid "" "Storing *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:1659 +#: ../../library/sys.rst:1690 msgid "" "Storing *object* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *object* after the custom " "hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1663 +#: ../../library/sys.rst:1694 msgid "See also :func:`excepthook` which handles uncaught exceptions." msgstr "" -#: ../../library/sys.rst:1665 +#: ../../library/sys.rst:1696 msgid "" "Raises an :ref:`auditing event ` ``sys.unraisablehook`` with " "arguments ``hook``, ``unraisable``." msgstr "" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1698 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments ``hook``, " "``unraisable`` when an exception that cannot be handled occurs. The " @@ -2364,7 +2415,7 @@ msgid "" "hook has been set, ``hook`` may be ``None``." msgstr "" -#: ../../library/sys.rst:1676 +#: ../../library/sys.rst:1707 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2373,13 +2424,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1685 +#: ../../library/sys.rst:1716 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1691 +#: ../../library/sys.rst:1722 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2390,18 +2441,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1699 +#: ../../library/sys.rst:1730 msgid "Added named component attributes." msgstr "" -#: ../../library/sys.rst:1704 +#: ../../library/sys.rst:1735 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:1711 +#: ../../library/sys.rst:1742 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 " @@ -2410,25 +2461,25 @@ msgid "" "on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:1722 +#: ../../library/sys.rst:1753 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:1738 +#: ../../library/sys.rst:1769 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:1746 +#: ../../library/sys.rst:1777 msgid "Citations" msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1778 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/" diff --git a/library/test.po b/library/test.po index b327874f616..362f0468358 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-05-28 00:16+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -631,7 +631,7 @@ msgid "Context manager to swap out an attribute with a new object." msgstr "" #: ../../library/test.rst:581 ../../library/test.rst:599 -#: ../../library/test.rst:819 ../../library/test.rst:1282 +#: ../../library/test.rst:819 ../../library/test.rst:1292 msgid "Usage::" msgstr "" "用法:\n" @@ -953,7 +953,7 @@ msgid "" "as part of the public API even though their names indicate otherwise." msgstr "" -#: ../../library/test.rst:908 ../../library/test.rst:1531 +#: ../../library/test.rst:908 ../../library/test.rst:1541 msgid "Example use::" msgstr "" "用法範例:\n" @@ -971,76 +971,84 @@ msgstr "" msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: ../../library/test.rst:945 +#: ../../library/test.rst:947 +msgid "" +"This function returns a context manager that will change the global :func:" +"`sys.set_int_max_str_digits` setting for the duration of the context to " +"allow execution of test code that needs a different limit on the number of " +"digits when converting between an integer and string." +msgstr "" + +#: ../../library/test.rst:955 msgid "The :mod:`test.support` module defines the following classes:" msgstr "" -#: ../../library/test.rst:950 +#: ../../library/test.rst:960 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: ../../library/test.rst:953 +#: ../../library/test.rst:963 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: ../../library/test.rst:956 +#: ../../library/test.rst:966 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :attr:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" -#: ../../library/test.rst:960 +#: ../../library/test.rst:970 msgid "On both platforms, the old value is restored by :meth:`__exit__`." msgstr "" -#: ../../library/test.rst:965 +#: ../../library/test.rst:975 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: ../../library/test.rst:970 +#: ../../library/test.rst:980 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: ../../library/test.rst:975 +#: ../../library/test.rst:985 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: ../../library/test.rst:983 +#: ../../library/test.rst:993 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: ../../library/test.rst:988 +#: ../../library/test.rst:998 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: ../../library/test.rst:995 +#: ../../library/test.rst:1005 msgid "Run *test* and return the result." msgstr "" -#: ../../library/test.rst:999 +#: ../../library/test.rst:1009 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr "" -#: ../../library/test.rst:1005 +#: ../../library/test.rst:1015 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: ../../library/test.rst:1012 +#: ../../library/test.rst:1022 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1017 +#: ../../library/test.rst:1027 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " @@ -1051,7 +1059,7 @@ msgid "" "port is returned." msgstr "" -#: ../../library/test.rst:1026 +#: ../../library/test.rst:1036 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1064,7 +1072,7 @@ msgid "" "simultaneously, which is a problem for buildbots." msgstr "" -#: ../../library/test.rst:1040 +#: ../../library/test.rst:1050 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1077,7 +1085,7 @@ msgid "" "testing multicasting via multiple UDP sockets." msgstr "" -#: ../../library/test.rst:1051 +#: ../../library/test.rst:1061 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1085,58 +1093,58 @@ msgid "" "test." msgstr "" -#: ../../library/test.rst:1059 +#: ../../library/test.rst:1069 msgid "" "Bind a unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" -#: ../../library/test.rst:1065 +#: ../../library/test.rst:1075 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: ../../library/test.rst:1071 +#: ../../library/test.rst:1081 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: ../../library/test.rst:1077 +#: ../../library/test.rst:1087 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr "" -#: ../../library/test.rst:1083 +#: ../../library/test.rst:1093 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" -#: ../../library/test.rst:1088 +#: ../../library/test.rst:1098 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: ../../library/test.rst:1091 +#: ../../library/test.rst:1101 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: ../../library/test.rst:1095 +#: ../../library/test.rst:1105 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: ../../library/test.rst:1099 +#: ../../library/test.rst:1109 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1144,85 +1152,85 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1107 +#: ../../library/test.rst:1117 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: ../../library/test.rst:1111 ../../library/test.rst:1127 -#: ../../library/test.rst:1139 +#: ../../library/test.rst:1121 ../../library/test.rst:1137 +#: ../../library/test.rst:1149 msgid "The function no longer strips whitespaces from *stderr*." msgstr "" -#: ../../library/test.rst:1117 +#: ../../library/test.rst:1127 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1121 +#: ../../library/test.rst:1131 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: ../../library/test.rst:1124 +#: ../../library/test.rst:1134 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1133 +#: ../../library/test.rst:1143 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1137 +#: ../../library/test.rst:1147 msgid "See :func:`assert_python_ok` for more options." msgstr "更多選項請見 :func:`assert_python_ok`\\ 。" -#: ../../library/test.rst:1145 +#: ../../library/test.rst:1155 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: ../../library/test.rst:1147 +#: ../../library/test.rst:1157 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" -#: ../../library/test.rst:1153 +#: ../../library/test.rst:1163 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: ../../library/test.rst:1159 +#: ../../library/test.rst:1169 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: ../../library/test.rst:1166 +#: ../../library/test.rst:1176 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: ../../library/test.rst:1173 +#: ../../library/test.rst:1183 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: ../../library/test.rst:1180 +#: ../../library/test.rst:1190 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1231,60 +1239,60 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: ../../library/test.rst:1188 +#: ../../library/test.rst:1198 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" -#: ../../library/test.rst:1193 +#: ../../library/test.rst:1203 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" -#: ../../library/test.rst:1198 +#: ../../library/test.rst:1208 msgid "The module defines the following class:" msgstr "" -#: ../../library/test.rst:1202 +#: ../../library/test.rst:1212 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: ../../library/test.rst:1206 +#: ../../library/test.rst:1216 msgid "Return the disassembly of *co* as string." msgstr "" -#: ../../library/test.rst:1211 +#: ../../library/test.rst:1221 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: ../../library/test.rst:1216 +#: ../../library/test.rst:1226 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: ../../library/test.rst:1220 +#: ../../library/test.rst:1230 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: ../../library/test.rst:1225 +#: ../../library/test.rst:1235 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: ../../library/test.rst:1232 +#: ../../library/test.rst:1242 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: ../../library/test.rst:1238 +#: ../../library/test.rst:1248 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: ../../library/test.rst:1243 +#: ../../library/test.rst:1253 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1292,79 +1300,79 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: ../../library/test.rst:1251 +#: ../../library/test.rst:1261 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: ../../library/test.rst:1257 +#: ../../library/test.rst:1267 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: ../../library/test.rst:1262 +#: ../../library/test.rst:1272 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: ../../library/test.rst:1268 +#: ../../library/test.rst:1278 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" -#: ../../library/test.rst:1271 +#: ../../library/test.rst:1281 msgid "Attributes set when an exception is caught:" msgstr "" -#: ../../library/test.rst:1273 +#: ../../library/test.rst:1283 msgid "``exc_type``" msgstr "``exc_type``" -#: ../../library/test.rst:1274 +#: ../../library/test.rst:1284 msgid "``exc_value``" msgstr "``exc_value``" -#: ../../library/test.rst:1275 +#: ../../library/test.rst:1285 msgid "``exc_traceback``" msgstr "``exc_traceback``" -#: ../../library/test.rst:1276 +#: ../../library/test.rst:1286 msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1278 +#: ../../library/test.rst:1288 msgid "See :func:`threading.excepthook` documentation." msgstr "參閱 :func:`threading.excepthook` 文件。" -#: ../../library/test.rst:1280 +#: ../../library/test.rst:1290 msgid "These attributes are deleted at the context manager exit." msgstr "" -#: ../../library/test.rst:1300 +#: ../../library/test.rst:1310 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr "" -#: ../../library/test.rst:1305 +#: ../../library/test.rst:1315 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr "" -#: ../../library/test.rst:1312 +#: ../../library/test.rst:1322 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: ../../library/test.rst:1317 +#: ../../library/test.rst:1327 msgid "Set to :func:`os.getcwd`." msgstr "" -#: ../../library/test.rst:1322 +#: ../../library/test.rst:1332 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: ../../library/test.rst:1328 +#: ../../library/test.rst:1338 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1372,25 +1380,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: ../../library/test.rst:1336 +#: ../../library/test.rst:1346 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1343 +#: ../../library/test.rst:1353 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1350 +#: ../../library/test.rst:1360 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: ../../library/test.rst:1355 +#: ../../library/test.rst:1365 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1399,75 +1407,75 @@ msgid "" "instance will be rolled back." msgstr "" -#: ../../library/test.rst:1361 +#: ../../library/test.rst:1371 msgid "Added dictionary interface." msgstr "" -#: ../../library/test.rst:1367 +#: ../../library/test.rst:1377 msgid "" "Simple :term:`path-like object`. It implements the :meth:`__fspath__` " "method which just returns the *path* argument. If *path* is an exception, " "it will be raised in :meth:`!__fspath__`." msgstr "" -#: ../../library/test.rst:1374 +#: ../../library/test.rst:1384 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: ../../library/test.rst:1380 +#: ../../library/test.rst:1390 msgid "Temporarily unset the environment variable ``envvar``." msgstr "" -#: ../../library/test.rst:1385 +#: ../../library/test.rst:1395 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1391 +#: ../../library/test.rst:1401 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1397 +#: ../../library/test.rst:1407 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: ../../library/test.rst:1400 +#: ../../library/test.rst:1410 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: ../../library/test.rst:1407 +#: ../../library/test.rst:1417 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: ../../library/test.rst:1412 +#: ../../library/test.rst:1422 msgid "Count the number of open file descriptors." msgstr "" -#: ../../library/test.rst:1417 +#: ../../library/test.rst:1427 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: ../../library/test.rst:1422 +#: ../../library/test.rst:1432 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: ../../library/test.rst:1428 +#: ../../library/test.rst:1438 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: ../../library/test.rst:1436 +#: ../../library/test.rst:1446 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " @@ -1475,21 +1483,21 @@ msgid "" "the files." msgstr "" -#: ../../library/test.rst:1444 +#: ../../library/test.rst:1454 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: ../../library/test.rst:1449 +#: ../../library/test.rst:1459 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: ../../library/test.rst:1454 +#: ../../library/test.rst:1464 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: ../../library/test.rst:1457 +#: ../../library/test.rst:1467 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " @@ -1497,20 +1505,20 @@ msgid "" "`tempfile.mkdtemp`." msgstr "" -#: ../../library/test.rst:1462 +#: ../../library/test.rst:1472 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: ../../library/test.rst:1469 +#: ../../library/test.rst:1479 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: ../../library/test.rst:1472 +#: ../../library/test.rst:1482 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " @@ -1518,34 +1526,34 @@ msgid "" "created, only a warning is issued." msgstr "" -#: ../../library/test.rst:1480 +#: ../../library/test.rst:1490 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: ../../library/test.rst:1485 +#: ../../library/test.rst:1495 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: ../../library/test.rst:1491 +#: ../../library/test.rst:1501 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr "" -#: ../../library/test.rst:1496 +#: ../../library/test.rst:1506 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr "" -#: ../../library/test.rst:1503 +#: ../../library/test.rst:1513 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: ../../library/test.rst:1509 +#: ../../library/test.rst:1519 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1553,46 +1561,46 @@ msgid "" "operation." msgstr "" -#: ../../library/test.rst:1514 +#: ../../library/test.rst:1524 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: ../../library/test.rst:1517 +#: ../../library/test.rst:1527 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: ../../library/test.rst:1521 +#: ../../library/test.rst:1531 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: ../../library/test.rst:1525 +#: ../../library/test.rst:1535 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: ../../library/test.rst:1528 +#: ../../library/test.rst:1538 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1545 +#: ../../library/test.rst:1555 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1549 +#: ../../library/test.rst:1559 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1600,21 +1608,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: ../../library/test.rst:1559 +#: ../../library/test.rst:1569 msgid "Return a copy of :data:`sys.modules`." msgstr "" -#: ../../library/test.rst:1564 +#: ../../library/test.rst:1574 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: ../../library/test.rst:1570 +#: ../../library/test.rst:1580 msgid "Delete *name* from ``sys.modules``." msgstr "" -#: ../../library/test.rst:1575 +#: ../../library/test.rst:1585 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1622,49 +1630,49 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: ../../library/test.rst:1583 +#: ../../library/test.rst:1593 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" -#: ../../library/test.rst:1593 +#: ../../library/test.rst:1603 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: ../../library/test.rst:1595 +#: ../../library/test.rst:1605 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: ../../library/test.rst:1599 +#: ../../library/test.rst:1609 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: ../../library/test.rst:1605 +#: ../../library/test.rst:1615 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr "" -#: ../../library/test.rst:1610 +#: ../../library/test.rst:1620 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr "" -#: ../../library/test.rst:1617 +#: ../../library/test.rst:1627 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: ../../library/test.rst:1624 +#: ../../library/test.rst:1634 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -1676,7 +1684,7 @@ msgid "" "``None``, compares to the offset of the exception." msgstr "" -#: ../../library/test.rst:1638 +#: ../../library/test.rst:1648 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings()` that makes it " "easier to test that a warning was correctly raised. It is approximately " @@ -1685,7 +1693,7 @@ msgid "" "automatically validate the results that are recorded." msgstr "" -#: ../../library/test.rst:1644 +#: ../../library/test.rst:1654 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1697,15 +1705,15 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: ../../library/test.rst:1653 +#: ../../library/test.rst:1663 msgid "If no arguments are specified, it defaults to::" msgstr "" -#: ../../library/test.rst:1657 +#: ../../library/test.rst:1667 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: ../../library/test.rst:1659 +#: ../../library/test.rst:1669 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -1717,39 +1725,39 @@ msgid "" "return ``None``." msgstr "" -#: ../../library/test.rst:1668 +#: ../../library/test.rst:1678 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: ../../library/test.rst:1671 +#: ../../library/test.rst:1681 msgid "The context manager is designed to be used like this::" msgstr "" -#: ../../library/test.rst:1678 +#: ../../library/test.rst:1688 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: ../../library/test.rst:1681 +#: ../../library/test.rst:1691 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: ../../library/test.rst:1695 +#: ../../library/test.rst:1705 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: ../../library/test.rst:1698 +#: ../../library/test.rst:1708 msgid "New optional arguments *filters* and *quiet*." msgstr "" -#: ../../library/test.rst:1704 +#: ../../library/test.rst:1714 msgid "" "Class used to record warnings for unit tests. See documentation of :func:" "`check_warnings` above for more details." diff --git a/using/cmdline.po b/using/cmdline.po index fa12c60c1d2..3ef5c752f86 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-06 00:17+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -442,8 +442,8 @@ msgid "" "`sys.path`." msgstr "" -#: ../../using/cmdline.rst:344 ../../using/cmdline.rst:705 -#: ../../using/cmdline.rst:717 +#: ../../using/cmdline.rst:344 ../../using/cmdline.rst:717 +#: ../../using/cmdline.rst:729 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" @@ -493,7 +493,7 @@ msgid "" "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:386 ../../using/cmdline.rst:733 +#: ../../using/cmdline.rst:386 ../../using/cmdline.rst:745 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " @@ -566,7 +566,7 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:744 +#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:756 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." @@ -607,6 +607,13 @@ msgstr "" #: ../../using/cmdline.rst:460 msgid "" +"``-X int_max_str_digits`` configures the :ref:`integer string conversion " +"length limitation `. See also :envvar:" +"`PYTHONINTMAXSTRDIGITS`." +msgstr "" + +#: ../../using/cmdline.rst:463 +msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " "imports). Note that its output may be broken in multi-threaded " @@ -614,96 +621,100 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:465 +#: ../../using/cmdline.rst:468 msgid "" "``-X dev``: enable :ref:`Python Development Mode `, introducing " "additional runtime checks that are too expensive to be enabled by default." msgstr "" -#: ../../using/cmdline.rst:468 +#: ../../using/cmdline.rst:471 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode `. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode ` (even when it would " "otherwise activate automatically)." msgstr "" -#: ../../using/cmdline.rst:471 +#: ../../using/cmdline.rst:474 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:474 +#: ../../using/cmdline.rst:477 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:478 +#: ../../using/cmdline.rst:481 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:481 +#: ../../using/cmdline.rst:484 msgid "The :option:`-X` option was added." msgstr "" -#: ../../using/cmdline.rst:484 +#: ../../using/cmdline.rst:487 msgid "The ``-X faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:487 +#: ../../using/cmdline.rst:490 msgid "The ``-X showrefcount`` and ``-X tracemalloc`` options." msgstr "" -#: ../../using/cmdline.rst:490 +#: ../../using/cmdline.rst:493 msgid "The ``-X showalloccount`` option." msgstr "" -#: ../../using/cmdline.rst:493 +#: ../../using/cmdline.rst:496 msgid "The ``-X importtime``, ``-X dev`` and ``-X utf8`` options." msgstr "" -#: ../../using/cmdline.rst:496 +#: ../../using/cmdline.rst:499 msgid "" "The ``-X pycache_prefix`` option. The ``-X dev`` option now logs ``close()`` " "exceptions in :class:`io.IOBase` destructor." msgstr "" -#: ../../using/cmdline.rst:500 +#: ../../using/cmdline.rst:503 msgid "" "Using ``-X dev`` option, check *encoding* and *errors* arguments on string " "encoding and decoding operations." msgstr "" -#: ../../using/cmdline.rst:504 +#: ../../using/cmdline.rst:507 msgid "The ``-X showalloccount`` option has been removed." msgstr "" -#: ../../using/cmdline.rst:506 +#: ../../using/cmdline.rst:509 msgid "The ``-X warn_default_encoding`` option." msgstr "" -#: ../../using/cmdline.rst:510 +#: ../../using/cmdline.rst:512 +msgid "The ``-X int_max_str_digits`` option." +msgstr "" + +#: ../../using/cmdline.rst:516 msgid "The ``-X oldparser`` option." msgstr "" -#: ../../using/cmdline.rst:514 +#: ../../using/cmdline.rst:520 msgid "Options you shouldn't use" msgstr "" -#: ../../using/cmdline.rst:518 +#: ../../using/cmdline.rst:524 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:526 +#: ../../using/cmdline.rst:531 msgid "Environment variables" msgstr "" -#: ../../using/cmdline.rst:528 +#: ../../using/cmdline.rst:533 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -711,7 +722,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:535 +#: ../../using/cmdline.rst:540 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -720,14 +731,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:541 +#: ../../using/cmdline.rst:546 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:548 +#: ../../using/cmdline.rst:553 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -735,21 +746,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:553 +#: ../../using/cmdline.rst:558 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:557 +#: ../../using/cmdline.rst:562 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:561 +#: ../../using/cmdline.rst:566 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -757,13 +768,13 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:569 +#: ../../using/cmdline.rst:574 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:577 +#: ../../using/cmdline.rst:582 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -774,26 +785,26 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:584 +#: ../../using/cmdline.rst:589 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with " "argument ``filename``." msgstr "" -#: ../../using/cmdline.rst:586 +#: ../../using/cmdline.rst:591 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with the " "filename as the argument when called on startup." msgstr "" -#: ../../using/cmdline.rst:592 +#: ../../using/cmdline.rst:597 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:599 +#: ../../using/cmdline.rst:604 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -804,52 +815,52 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:611 +#: ../../using/cmdline.rst:616 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:618 +#: ../../using/cmdline.rst:623 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:621 +#: ../../using/cmdline.rst:626 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:627 +#: ../../using/cmdline.rst:632 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:633 +#: ../../using/cmdline.rst:638 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:640 +#: ../../using/cmdline.rst:645 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:646 +#: ../../using/cmdline.rst:651 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:653 +#: ../../using/cmdline.rst:658 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -857,33 +868,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:663 +#: ../../using/cmdline.rst:668 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:666 +#: ../../using/cmdline.rst:671 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:670 +#: ../../using/cmdline.rst:675 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:674 +#: ../../using/cmdline.rst:679 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:682 +#: ../../using/cmdline.rst:686 +msgid "" +"If this variable is set to an integer, it is used to configure the " +"interpreter's global :ref:`integer string conversion length limitation " +"`." +msgstr "" + +#: ../../using/cmdline.rst:694 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -891,17 +909,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:687 +#: ../../using/cmdline.rst:699 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:690 +#: ../../using/cmdline.rst:702 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:693 +#: ../../using/cmdline.rst:705 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -909,13 +927,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:700 +#: ../../using/cmdline.rst:712 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:710 +#: ../../using/cmdline.rst:722 msgid "" "Defines the :data:`user base directory `, which is used to " "compute the path of the :data:`user site-packages directory ` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:789 +#: ../../using/cmdline.rst:801 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:791 +#: ../../using/cmdline.rst:803 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:793 +#: ../../using/cmdline.rst:805 msgid "" "``default``: use the :ref:`default memory allocators `." msgstr "" -#: ../../using/cmdline.rst:795 +#: ../../using/cmdline.rst:807 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:data:`PYMEM_DOMAIN_RAW`, :c:data:`PYMEM_DOMAIN_MEM`, :c:data:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:798 +#: ../../using/cmdline.rst:810 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator ` for :c:data:" "`PYMEM_DOMAIN_MEM` and :c:data:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:data:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:802 +#: ../../using/cmdline.rst:814 msgid "Install :ref:`debug hooks `:" msgstr "" -#: ../../using/cmdline.rst:804 +#: ../../using/cmdline.rst:816 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "`." msgstr "" -#: ../../using/cmdline.rst:806 +#: ../../using/cmdline.rst:818 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:807 +#: ../../using/cmdline.rst:819 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:809 +#: ../../using/cmdline.rst:821 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:817 +#: ../../using/cmdline.rst:829 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator ` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:833 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:825 +#: ../../using/cmdline.rst:837 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:832 +#: ../../using/cmdline.rst:844 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1045,41 +1063,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:837 +#: ../../using/cmdline.rst:849 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding()`." msgstr "" -#: ../../using/cmdline.rst:841 ../../using/cmdline.rst:855 +#: ../../using/cmdline.rst:853 ../../using/cmdline.rst:867 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../using/cmdline.rst:842 +#: ../../using/cmdline.rst:854 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`\\ 。" -#: ../../using/cmdline.rst:847 +#: ../../using/cmdline.rst:859 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:851 +#: ../../using/cmdline.rst:863 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:861 +#: ../../using/cmdline.rst:873 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:865 +#: ../../using/cmdline.rst:877 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1090,19 +1108,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:873 +#: ../../using/cmdline.rst:885 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:874 +#: ../../using/cmdline.rst:886 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:875 +#: ../../using/cmdline.rst:887 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:877 +#: ../../using/cmdline.rst:889 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1115,7 +1133,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:899 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1125,7 +1143,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:894 +#: ../../using/cmdline.rst:906 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1133,7 +1151,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:911 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1142,64 +1160,64 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:906 +#: ../../using/cmdline.rst:918 msgid ":ref:`Availability `: \\*nix." msgstr ":ref:`適用 `:\\*nix。" -#: ../../using/cmdline.rst:907 +#: ../../using/cmdline.rst:919 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`\\ 。" -#: ../../using/cmdline.rst:913 +#: ../../using/cmdline.rst:925 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode `, introducing additional runtime checks " "that are too expensive to be enabled by default." msgstr "" -#: ../../using/cmdline.rst:921 +#: ../../using/cmdline.rst:933 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../using/cmdline.rst:923 +#: ../../using/cmdline.rst:935 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../using/cmdline.rst:925 +#: ../../using/cmdline.rst:937 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:932 +#: ../../using/cmdline.rst:944 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:935 +#: ../../using/cmdline.rst:947 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`\\ 。" -#: ../../using/cmdline.rst:941 +#: ../../using/cmdline.rst:953 msgid "Debug-mode variables" msgstr "" -#: ../../using/cmdline.rst:945 +#: ../../using/cmdline.rst:957 msgid "If set, Python will print threading debug info into stdout." msgstr "" -#: ../../using/cmdline.rst:947 +#: ../../using/cmdline.rst:959 msgid "Need a :ref:`debug build of Python `." msgstr "" -#: ../../using/cmdline.rst:954 +#: ../../using/cmdline.rst:966 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:957 +#: ../../using/cmdline.rst:969 msgid "" "Need Python configured with the :option:`--with-trace-refs` build option." msgstr "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index c3858a0d5f1..fa062a206f9 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2022-09-03 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3101,3 +3101,21 @@ msgid "" "The ``PyThreadState.use_tracing`` member has been removed to optimize " "Python. (Contributed by Mark Shannon in :issue:`43760`.)" msgstr "" + +#: ../../whatsnew/3.10.rst:2328 +msgid "Notable security feature in 3.10.7" +msgstr "" + +#: ../../whatsnew/3.10.rst:2330 +msgid "" +"Converting between :class:`int` and :class:`str` in bases other than 2 " +"(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " +"now raises a :exc:`ValueError` if the number of digits in string form is " +"above a limit to avoid potential denial of service attacks due to the " +"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " +"configured or disabled by environment variable, command line flag, or :mod:" +"`sys` APIs. See the :ref:`integer string conversion length limitation " +"` documentation. The default limit is 4300 digits in " +"string form." +msgstr ""