|
| 1 | +# SOME DESCRIPTIVE TITLE. |
| 2 | +# Copyright (C) 2001-2020, Python Software Foundation |
| 3 | +# This file is distributed under the same license as the Python package. |
| 4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 | +# |
| 6 | +# Translators: |
| 7 | +# Freesand Leo <[email protected]>, 2020 |
| 8 | +# ppcfish <[email protected]>, 2020 |
| 9 | +# |
| 10 | +#, fuzzy |
| 11 | +msgid "" |
| 12 | +msgstr "" |
| 13 | +"Project-Id-Version: Python 3.9\n" |
| 14 | +"Report-Msgid-Bugs-To: \n" |
| 15 | +"POT-Creation-Date: 2020-05-31 09:25+0000\n" |
| 16 | +"PO-Revision-Date: 2020-05-31 09:29+0000\n" |
| 17 | +" Last-Translator: ppcfish <[email protected]>, 2020\n" |
| 18 | +"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n" |
| 19 | +"MIME-Version: 1.0\n" |
| 20 | +"Content-Type: text/plain; charset=UTF-8\n" |
| 21 | +"Content-Transfer-Encoding: 8bit\n" |
| 22 | +"Language: zh_CN\n" |
| 23 | +"Plural-Forms: nplurals=1; plural=0;\n" |
| 24 | + |
| 25 | +#: ../../library/devmode.rst:4 |
| 26 | +msgid "Python Development Mode" |
| 27 | +msgstr "" |
| 28 | + |
| 29 | +#: ../../library/devmode.rst:8 |
| 30 | +msgid "" |
| 31 | +"The Python Development Mode introduces additional runtime checks that are " |
| 32 | +"too expensive to be enabled by default. It should not be more verbose than " |
| 33 | +"the default if the code is correct; new warnings are only emitted when an " |
| 34 | +"issue is detected." |
| 35 | +msgstr "" |
| 36 | + |
| 37 | +#: ../../library/devmode.rst:13 |
| 38 | +msgid "" |
| 39 | +"It can be enabled using the :option:`-X dev <-X>` command line option or by " |
| 40 | +"setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``." |
| 41 | +msgstr "" |
| 42 | + |
| 43 | +#: ../../library/devmode.rst:17 |
| 44 | +msgid "Effects of the Python Development Mode" |
| 45 | +msgstr "" |
| 46 | + |
| 47 | +#: ../../library/devmode.rst:19 |
| 48 | +msgid "" |
| 49 | +"Enabling the Python Development Mode is similar to the following command, " |
| 50 | +"but with additional effects described below::" |
| 51 | +msgstr "" |
| 52 | + |
| 53 | +#: ../../library/devmode.rst:24 |
| 54 | +msgid "Effects of the Python Development Mode:" |
| 55 | +msgstr "" |
| 56 | + |
| 57 | +#: ../../library/devmode.rst:26 |
| 58 | +msgid "" |
| 59 | +"Add ``default`` :ref:`warning filter <describing-warning-filters>`. The " |
| 60 | +"following warnings are shown:" |
| 61 | +msgstr "" |
| 62 | + |
| 63 | +#: ../../library/devmode.rst:29 |
| 64 | +msgid ":exc:`DeprecationWarning`" |
| 65 | +msgstr ":exc:`DeprecationWarning`" |
| 66 | + |
| 67 | +#: ../../library/devmode.rst:30 |
| 68 | +msgid ":exc:`ImportWarning`" |
| 69 | +msgstr ":exc:`ImportWarning`" |
| 70 | + |
| 71 | +#: ../../library/devmode.rst:31 |
| 72 | +msgid ":exc:`PendingDeprecationWarning`" |
| 73 | +msgstr ":exc:`PendingDeprecationWarning`" |
| 74 | + |
| 75 | +#: ../../library/devmode.rst:32 |
| 76 | +msgid ":exc:`ResourceWarning`" |
| 77 | +msgstr ":exc:`ResourceWarning`" |
| 78 | + |
| 79 | +#: ../../library/devmode.rst:34 |
| 80 | +msgid "" |
| 81 | +"Normally, the above warnings are filtered by the default :ref:`warning " |
| 82 | +"filters <describing-warning-filters>`." |
| 83 | +msgstr "" |
| 84 | + |
| 85 | +#: ../../library/devmode.rst:37 |
| 86 | +msgid "" |
| 87 | +"It behaves as if the :option:`-W default <-W>` command line option is used." |
| 88 | +msgstr "" |
| 89 | + |
| 90 | +#: ../../library/devmode.rst:39 |
| 91 | +msgid "" |
| 92 | +"Use the :option:`-W error <-W>` command line option or set the " |
| 93 | +":envvar:`PYTHONWARNINGS` environment variable to ``error`` to treat warnings" |
| 94 | +" as errors." |
| 95 | +msgstr "" |
| 96 | + |
| 97 | +#: ../../library/devmode.rst:43 |
| 98 | +msgid "Install debug hooks on memory allocators to check for:" |
| 99 | +msgstr "" |
| 100 | + |
| 101 | +#: ../../library/devmode.rst:45 |
| 102 | +msgid "Buffer underflow" |
| 103 | +msgstr "" |
| 104 | + |
| 105 | +#: ../../library/devmode.rst:46 |
| 106 | +msgid "Buffer overflow" |
| 107 | +msgstr "" |
| 108 | + |
| 109 | +#: ../../library/devmode.rst:47 |
| 110 | +msgid "Memory allocator API violation" |
| 111 | +msgstr "" |
| 112 | + |
| 113 | +#: ../../library/devmode.rst:48 |
| 114 | +msgid "Unsafe usage of the GIL" |
| 115 | +msgstr "" |
| 116 | + |
| 117 | +#: ../../library/devmode.rst:50 |
| 118 | +msgid "See the :c:func:`PyMem_SetupDebugHooks` C function." |
| 119 | +msgstr "" |
| 120 | + |
| 121 | +#: ../../library/devmode.rst:52 |
| 122 | +msgid "" |
| 123 | +"It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to " |
| 124 | +"``debug``." |
| 125 | +msgstr "" |
| 126 | + |
| 127 | +#: ../../library/devmode.rst:55 |
| 128 | +msgid "" |
| 129 | +"To enable the Python Development Mode without installing debug hooks on " |
| 130 | +"memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to " |
| 131 | +"``default``." |
| 132 | +msgstr "" |
| 133 | + |
| 134 | +#: ../../library/devmode.rst:59 |
| 135 | +msgid "" |
| 136 | +"Call :func:`faulthandler.enable` at Python startup to install handlers for " |
| 137 | +"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and" |
| 138 | +" :const:`SIGILL` signals to dump the Python traceback on a crash." |
| 139 | +msgstr "" |
| 140 | + |
| 141 | +#: ../../library/devmode.rst:63 |
| 142 | +msgid "" |
| 143 | +"It behaves as if the :option:`-X faulthandler <-X>` command line option is " |
| 144 | +"used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to " |
| 145 | +"``1``." |
| 146 | +msgstr "" |
| 147 | + |
| 148 | +#: ../../library/devmode.rst:67 |
| 149 | +msgid "" |
| 150 | +"Enable :ref:`asyncio debug mode <asyncio-debug-mode>`. For example, " |
| 151 | +":mod:`asyncio` checks for coroutines that were not awaited and logs them." |
| 152 | +msgstr "" |
| 153 | + |
| 154 | +#: ../../library/devmode.rst:70 |
| 155 | +msgid "" |
| 156 | +"It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is " |
| 157 | +"set to ``1``." |
| 158 | +msgstr "" |
| 159 | + |
| 160 | +#: ../../library/devmode.rst:73 |
| 161 | +msgid "" |
| 162 | +"Check the *encoding* and *errors* arguments for string encoding and decoding" |
| 163 | +" operations. Examples: :func:`open`, :meth:`str.encode` and " |
| 164 | +":meth:`bytes.decode`." |
| 165 | +msgstr "" |
| 166 | + |
| 167 | +#: ../../library/devmode.rst:77 |
| 168 | +msgid "" |
| 169 | +"By default, for best performance, the *errors* argument is only checked at " |
| 170 | +"the first encoding/decoding error and the *encoding* argument is sometimes " |
| 171 | +"ignored for empty strings." |
| 172 | +msgstr "" |
| 173 | + |
| 174 | +#: ../../library/devmode.rst:81 |
| 175 | +msgid "The :class:`io.IOBase` destructor logs ``close()`` exceptions." |
| 176 | +msgstr "" |
| 177 | + |
| 178 | +#: ../../library/devmode.rst:82 |
| 179 | +msgid "" |
| 180 | +"Set the :attr:`~sys.flags.dev_mode` attribute of :attr:`sys.flags` to " |
| 181 | +"``True``." |
| 182 | +msgstr "将 :attr:`sys.flags` 的 :attr:`~sys.flags.dev_mode` 属性设为 ``True``。" |
| 183 | + |
| 184 | +#: ../../library/devmode.rst:85 |
| 185 | +msgid "" |
| 186 | +"The Python Development Mode does not enable the :mod:`tracemalloc` module by" |
| 187 | +" default, because the overhead cost (to performance and memory) would be too" |
| 188 | +" large. Enabling the :mod:`tracemalloc` module provides additional " |
| 189 | +"information on the origin of some errors. For example, " |
| 190 | +":exc:`ResourceWarning` logs the traceback where the resource was allocated, " |
| 191 | +"and a buffer overflow error logs the traceback where the memory block was " |
| 192 | +"allocated." |
| 193 | +msgstr "" |
| 194 | + |
| 195 | +#: ../../library/devmode.rst:92 |
| 196 | +msgid "" |
| 197 | +"The Python Development Mode does not prevent the :option:`-O` command line " |
| 198 | +"option from removing :keyword:`assert` statements nor from setting " |
| 199 | +":const:`__debug__` to ``False``." |
| 200 | +msgstr "" |
| 201 | + |
| 202 | +#: ../../library/devmode.rst:96 |
| 203 | +msgid "The :class:`io.IOBase` destructor now logs ``close()`` exceptions." |
| 204 | +msgstr "" |
| 205 | + |
| 206 | +#: ../../library/devmode.rst:99 |
| 207 | +msgid "" |
| 208 | +"The *encoding* and *errors* arguments are now checked for string encoding " |
| 209 | +"and decoding operations." |
| 210 | +msgstr "" |
| 211 | + |
| 212 | +#: ../../library/devmode.rst:105 |
| 213 | +msgid "ResourceWarning Example" |
| 214 | +msgstr "" |
| 215 | + |
| 216 | +#: ../../library/devmode.rst:107 |
| 217 | +msgid "" |
| 218 | +"Example of a script counting the number of lines of the text file specified " |
| 219 | +"in the command line::" |
| 220 | +msgstr "" |
| 221 | + |
| 222 | +#: ../../library/devmode.rst:121 |
| 223 | +msgid "" |
| 224 | +"The script does not close the file explicitly. By default, Python does not " |
| 225 | +"emit any warning. Example using README.txt, which has 269 lines:" |
| 226 | +msgstr "" |
| 227 | + |
| 228 | +#: ../../library/devmode.rst:129 |
| 229 | +msgid "" |
| 230 | +"Enabling the Python Development Mode displays a :exc:`ResourceWarning` " |
| 231 | +"warning:" |
| 232 | +msgstr "" |
| 233 | + |
| 234 | +#: ../../library/devmode.rst:139 |
| 235 | +msgid "" |
| 236 | +"In addition, enabling :mod:`tracemalloc` shows the line where the file was " |
| 237 | +"opened:" |
| 238 | +msgstr "" |
| 239 | + |
| 240 | +#: ../../library/devmode.rst:154 |
| 241 | +msgid "" |
| 242 | +"The fix is to close explicitly the file. Example using a context manager::" |
| 243 | +msgstr "" |
| 244 | + |
| 245 | +#: ../../library/devmode.rst:162 |
| 246 | +msgid "" |
| 247 | +"Not closing a resource explicitly can leave a resource open for way longer " |
| 248 | +"than expected; it can cause severe issues upon exiting Python. It is bad in " |
| 249 | +"CPython, but it is even worse in PyPy. Closing resources explicitly makes an" |
| 250 | +" application more deterministic and more reliable." |
| 251 | +msgstr "" |
| 252 | + |
| 253 | +#: ../../library/devmode.rst:169 |
| 254 | +msgid "Bad file descriptor error example" |
| 255 | +msgstr "" |
| 256 | + |
| 257 | +#: ../../library/devmode.rst:171 |
| 258 | +msgid "Script displaying the first line of itself::" |
| 259 | +msgstr "" |
| 260 | + |
| 261 | +#: ../../library/devmode.rst:184 |
| 262 | +msgid "By default, Python does not emit any warning:" |
| 263 | +msgstr "" |
| 264 | + |
| 265 | +#: ../../library/devmode.rst:191 |
| 266 | +msgid "" |
| 267 | +"The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad " |
| 268 | +"file descriptor\" error when finalizing the file object:" |
| 269 | +msgstr "" |
| 270 | + |
| 271 | +#: ../../library/devmode.rst:207 |
| 272 | +msgid "" |
| 273 | +"``os.close(fp.fileno())`` closes the file descriptor. When the file object " |
| 274 | +"finalizer tries to close the file descriptor again, it fails with the ``Bad " |
| 275 | +"file descriptor`` error. A file descriptor must be closed only once. In the " |
| 276 | +"worst case scenario, closing it twice can lead to a crash (see " |
| 277 | +":issue:`18748` for an example)." |
| 278 | +msgstr "" |
| 279 | + |
| 280 | +#: ../../library/devmode.rst:213 |
| 281 | +msgid "" |
| 282 | +"The fix is to remove the ``os.close(fp.fileno())`` line, or open the file " |
| 283 | +"with ``closefd=False``." |
| 284 | +msgstr "" |
0 commit comments