44# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55#
66# Translators:
7- # Freesand Leo <[email protected] >, 202087# ppcfish <[email protected] >, 202098# Alpha Du <[email protected] >, 20219+ # Dai Xu <[email protected] >, 202110+ # Freesand Leo <[email protected] >, 20211011#
1112#, fuzzy
1213msgid ""
@@ -15,7 +16,7 @@ msgstr ""
1516"Report-Msgid-Bugs-To : \n "
1617"POT-Creation-Date : 2021-01-01 05:02+0000\n "
1718"PO-Revision-Date : 2020-05-31 09:29+0000\n "
18- "Last-Translator : Alpha Du <alphanow@gmail .com>, 2021\n "
19+ "Last-Translator : Freesand Leo <yuqinju@163 .com>, 2021\n "
1920"Language-Team : Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n "
2021"MIME-Version : 1.0\n "
2122"Content-Type : text/plain; charset=UTF-8\n "
@@ -47,23 +48,25 @@ msgstr ""
4748
4849#: ../../library/devmode.rst:17
4950msgid "Effects of the Python Development Mode"
50- msgstr ""
51+ msgstr "Python 开发模式的效果 "
5152
5253#: ../../library/devmode.rst:19
5354msgid ""
5455"Enabling the Python Development Mode is similar to the following command, "
5556"but with additional effects described below::"
56- msgstr ""
57+ msgstr "启用 Python 开发模式后的效果,与以下命令类似,不过还有下面的额外效果: "
5758
5859#: ../../library/devmode.rst:24
5960msgid "Effects of the Python Development Mode:"
60- msgstr ""
61+ msgstr "Python 开发模式的效果: "
6162
6263#: ../../library/devmode.rst:26
6364msgid ""
6465"Add ``default`` :ref:`warning filter <describing-warning-filters>`. The "
6566"following warnings are shown:"
6667msgstr ""
68+ "加入 ``default`` :ref:`warning filter <describing-warning-filters>` "
69+ "。下述警告信息将会显示出来:"
6770
6871#: ../../library/devmode.rst:29
6972msgid ":exc:`DeprecationWarning`"
@@ -86,99 +89,114 @@ msgid ""
8689"Normally, the above warnings are filtered by the default :ref:`warning "
8790"filters <describing-warning-filters>`."
8891msgstr ""
92+ "通常上述警告是由默认的 :ref:`warning filters <describing-warning-filters>` 负责处理的。"
8993
9094#: ../../library/devmode.rst:37
9195msgid ""
9296"It behaves as if the :option:`-W default <-W>` command line option is used."
93- msgstr ""
97+ msgstr "其行为相当于使用了 :option:`-W default <-W>` 命令行选项。 "
9498
9599#: ../../library/devmode.rst:39
96100msgid ""
97101"Use the :option:`-W error <-W>` command line option or set the "
98102":envvar:`PYTHONWARNINGS` environment variable to ``error`` to treat warnings"
99103" as errors."
100104msgstr ""
105+ "使用命令行参数 :option:`-W error <-W>` 或将环境变量 :envvar:`PYTHONWARNINGS` 设为 "
106+ "``error``,可将警告视为错误。"
101107
102108#: ../../library/devmode.rst:43
103109msgid "Install debug hooks on memory allocators to check for:"
104- msgstr ""
110+ msgstr "在内存分配程序中安装调试钩子,用以查看: "
105111
106112#: ../../library/devmode.rst:45
107113msgid "Buffer underflow"
108- msgstr ""
114+ msgstr "缓冲区下溢 "
109115
110116#: ../../library/devmode.rst:46
111117msgid "Buffer overflow"
112- msgstr ""
118+ msgstr "缓冲区上溢 "
113119
114120#: ../../library/devmode.rst:47
115121msgid "Memory allocator API violation"
116- msgstr ""
122+ msgstr "内存分配 API 冲突 "
117123
118124#: ../../library/devmode.rst:48
119125msgid "Unsafe usage of the GIL"
120- msgstr ""
126+ msgstr "不安全的 GIL 调用 "
121127
122128#: ../../library/devmode.rst:50
123129msgid "See the :c:func:`PyMem_SetupDebugHooks` C function."
124- msgstr ""
130+ msgstr "参见 C 函数 :c:func:`PyMem_SetupDebugHooks` 。 "
125131
126132#: ../../library/devmode.rst:52
127133msgid ""
128134"It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to "
129135"``debug``."
130- msgstr ""
136+ msgstr "效果类似于将环境变量 :envvar:`PYTHONMALLOC` 设为 ``debug``。 "
131137
132138#: ../../library/devmode.rst:55
133139msgid ""
134140"To enable the Python Development Mode without installing debug hooks on "
135141"memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to "
136142"``default``."
137143msgstr ""
144+ "若要启用 Python 开发模式,却又不要在内存分配程序中安装调试钩子,请将 环境变量 :envvar:`PYTHONMALLOC` 设为 "
145+ "``default``。"
138146
139147#: ../../library/devmode.rst:59
140148msgid ""
141149"Call :func:`faulthandler.enable` at Python startup to install handlers for "
142150"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and"
143151" :const:`SIGILL` signals to dump the Python traceback on a crash."
144152msgstr ""
153+ "在启动 Python 时调用 :func:`faulthandler.enable` ,会安装 :const:`SIGSEGV` 、 "
154+ ":const:`SIGFPE` 、 :const:`SIGABRT` 、 :const:`SIGBUS` 和 :const:`SIGILL` "
155+ "信号的处理程序,以便在程序崩溃时将 Python 跟踪信息转储下来。"
145156
146157#: ../../library/devmode.rst:63
147158msgid ""
148159"It behaves as if the :option:`-X faulthandler <-X>` command line option is "
149160"used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to "
150161"``1``."
151162msgstr ""
163+ "其行为如同使用了 :option:`-X faulthandler <-X>` 命令行选项或将 :envvar:`PYTHONFAULTHANDLER`"
164+ " 环境变量设为 ``1``。"
152165
153166#: ../../library/devmode.rst:67
154167msgid ""
155168"Enable :ref:`asyncio debug mode <asyncio-debug-mode>`. For example, "
156169":mod:`asyncio` checks for coroutines that were not awaited and logs them."
157170msgstr ""
171+ "启用 :ref:`asyncio debug mode <asyncio-debug-mode>`。比如 :mod:`asyncio` "
172+ "会检查没有等待的协程并记录下来。"
158173
159174#: ../../library/devmode.rst:70
160175msgid ""
161176"It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is "
162177"set to ``1``."
163- msgstr ""
178+ msgstr "效果如同将环境变量 :envvar:`PYTHONASYNCIODEBUG` 设为 ``1``。 "
164179
165180#: ../../library/devmode.rst:73
166181msgid ""
167182"Check the *encoding* and *errors* arguments for string encoding and decoding"
168183" operations. Examples: :func:`open`, :meth:`str.encode` and "
169184":meth:`bytes.decode`."
170185msgstr ""
186+ "检查字符串编码和解码函数的 *encoding* 和 *errors* 参数。例如: :func:`open` 、 :meth:`str.encode`"
187+ " 和 :meth:`bytes.decode`。"
171188
172189#: ../../library/devmode.rst:77
173190msgid ""
174191"By default, for best performance, the *errors* argument is only checked at "
175192"the first encoding/decoding error and the *encoding* argument is sometimes "
176193"ignored for empty strings."
177194msgstr ""
195+ "为了获得最佳性能,默认只会在第一次编码/解码错误时才会检查 *errors* 参数,有时 *encoding* 参数为空字符串时还会被忽略。"
178196
179197#: ../../library/devmode.rst:81
180198msgid "The :class:`io.IOBase` destructor logs ``close()`` exceptions."
181- msgstr ""
199+ msgstr ":class:`io.IOBase` 的析构函数会记录 ``close()`` 触发的异常。 "
182200
183201#: ../../library/devmode.rst:82
184202msgid ""
@@ -196,56 +214,61 @@ msgid ""
196214"and a buffer overflow error logs the traceback where the memory block was "
197215"allocated."
198216msgstr ""
217+ "Python 开发模式下,默认不会启用 :mod:`tracemalloc` 模块,因为其性能和内存开销太大。启用 :mod:`tracemalloc`"
218+ " 模块后,能够提供有关错误来源的一些额外信息。例如,:exc:`ResourceWarning` "
219+ "记录了资源分配的跟踪信息,而缓冲区溢出错误记录了内存块分配的跟踪信息。"
199220
200221#: ../../library/devmode.rst:92
201222msgid ""
202223"The Python Development Mode does not prevent the :option:`-O` command line "
203224"option from removing :keyword:`assert` statements nor from setting "
204225":const:`__debug__` to ``False``."
205226msgstr ""
227+ "Python 开发模式不会阻止命令行参数 :option:`-O` 删除 :keyword:`assert` 语句,也不会阻止将 "
228+ ":const:`__debug__` 设为 ``False``。"
206229
207230#: ../../library/devmode.rst:96
208231msgid "The :class:`io.IOBase` destructor now logs ``close()`` exceptions."
209- msgstr ""
232+ msgstr "现在, :class:`io.IOBase` 的析构函数会记录 ``close()`` 触发的异常。 "
210233
211234#: ../../library/devmode.rst:99
212235msgid ""
213236"The *encoding* and *errors* arguments are now checked for string encoding "
214237"and decoding operations."
215- msgstr ""
238+ msgstr "现在,字符串编码和解码操作时会检查 *encoding* 和 *errors* 参数。 "
216239
217240#: ../../library/devmode.rst:105
218241msgid "ResourceWarning Example"
219- msgstr ""
242+ msgstr "ResourceWarning 示例 "
220243
221244#: ../../library/devmode.rst:107
222245msgid ""
223246"Example of a script counting the number of lines of the text file specified "
224247"in the command line::"
225- msgstr ""
248+ msgstr "以下示例将统计由命令行指定的文本文件的行数: "
226249
227250#: ../../library/devmode.rst:121
228251msgid ""
229252"The script does not close the file explicitly. By default, Python does not "
230253"emit any warning. Example using README.txt, which has 269 lines:"
231- msgstr ""
254+ msgstr "上述代码没有显式关闭文件。默认情况下,Python 不会触发任何警告。下面用 README.txt 文件测试下,有 269 行。 "
232255
233256#: ../../library/devmode.rst:129
234257msgid ""
235258"Enabling the Python Development Mode displays a :exc:`ResourceWarning` "
236259"warning:"
237- msgstr ""
260+ msgstr "启用 Python 开发模式后,则会显示一条 :exc:`ResourceWarning` 警告。 "
238261
239262#: ../../library/devmode.rst:139
240263msgid ""
241264"In addition, enabling :mod:`tracemalloc` shows the line where the file was "
242265"opened:"
243- msgstr ""
266+ msgstr "启用 :mod:`tracemalloc` 后,则还会显示打开文件的那行代码: "
244267
245268#: ../../library/devmode.rst:154
246269msgid ""
247270"The fix is to close explicitly the file. Example using a context manager::"
248- msgstr ""
271+ msgstr "修正方案就是显式关闭文件。下面用上下文管理器作为示例: "
249272
250273#: ../../library/devmode.rst:162
251274msgid ""
@@ -254,24 +277,28 @@ msgid ""
254277"CPython, but it is even worse in PyPy. Closing resources explicitly makes an"
255278" application more deterministic and more reliable."
256279msgstr ""
280+ "未能显式关闭资源,会让资源打开时长远超预期;在退出 Python 时可能会导致严重问题。这在 CPython 中比较糟糕,但在 PyPy "
281+ "中会更糟。显式关闭资源能让应用程序更加稳定可靠。"
257282
258283#: ../../library/devmode.rst:169
259284msgid "Bad file descriptor error example"
260- msgstr ""
285+ msgstr "文件描述符错误示例 "
261286
262287#: ../../library/devmode.rst:171
263288msgid "Script displaying the first line of itself::"
264- msgstr ""
289+ msgstr "显示自身的第一行代码: "
265290
266291#: ../../library/devmode.rst:184
267292msgid "By default, Python does not emit any warning:"
268- msgstr ""
293+ msgstr "默认情况下,Python 不会触发任何警告: "
269294
270295#: ../../library/devmode.rst:191
271296msgid ""
272297"The Python Development Mode shows a :exc:`ResourceWarning` and logs a \" Bad "
273298"file descriptor\" error when finalizing the file object:"
274299msgstr ""
300+ "在 Python 开发模式下,会在析构文件对象时显示 :exc:`ResourceWarning` 并记录 “Bad file descriptor” "
301+ "错误。"
275302
276303#: ../../library/devmode.rst:207
277304msgid ""
@@ -281,9 +308,11 @@ msgid ""
281308"worst case scenario, closing it twice can lead to a crash (see "
282309":issue:`18748` for an example)."
283310msgstr ""
311+ "``os.close(fp.fileno())`` 会关闭文件描述符。当文件对象析构函数试图再次关闭文件描述符时会失败,并触发 ``Bad file "
312+ "descriptor`` 错误。每个文件描述符只允许关闭一次。在最坏的情况下,关闭两次会导致程序崩溃(示例可参见 :issue:`18748` )。"
284313
285314#: ../../library/devmode.rst:213
286315msgid ""
287316"The fix is to remove the ``os.close(fp.fileno())`` line, or open the file "
288317"with ``closefd=False``."
289- msgstr ""
318+ msgstr "修正方案是删除 ``os.close(fp.fileno())`` 这一行,或者打开文件时带上 ``closefd=False`` 参数。 "
0 commit comments