|
| 1 | +# SOME DESCRIPTIVE TITLE. |
| 2 | +# Copyright (C) 2001-2024, 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 | +# nick <2330458484@qq.com>, 2024 |
| 8 | +# Freesand Leo <yuqinju@163.com>, 2024 |
| 9 | +# Jiuh.star <jiuh.star@gmail.com>, 2024 |
| 10 | +# |
| 11 | +#, fuzzy |
| 12 | +msgid "" |
| 13 | +msgstr "" |
| 14 | +"Project-Id-Version: Python 3.13\n" |
| 15 | +"Report-Msgid-Bugs-To: \n" |
| 16 | +"POT-Creation-Date: 2024-10-04 14:17+0000\n" |
| 17 | +"PO-Revision-Date: 2024-10-04 14:19+0000\n" |
| 18 | +"Last-Translator: Jiuh.star <jiuh.star@gmail.com>, 2024\n" |
| 19 | +"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" |
| 20 | +"MIME-Version: 1.0\n" |
| 21 | +"Content-Type: text/plain; charset=UTF-8\n" |
| 22 | +"Content-Transfer-Encoding: 8bit\n" |
| 23 | +"Language: zh_CN\n" |
| 24 | +"Plural-Forms: nplurals=1; plural=0;\n" |
| 25 | + |
| 26 | +#: ../../howto/free-threading-python.rst:5 |
| 27 | +msgid "Python experimental support for free threading" |
| 28 | +msgstr "Python 对自由线程的实验性支持" |
| 29 | + |
| 30 | +#: ../../howto/free-threading-python.rst:7 |
| 31 | +msgid "" |
| 32 | +"Starting with the 3.13 release, CPython has experimental support for a build" |
| 33 | +" of Python called :term:`free threading` where the :term:`global interpreter" |
| 34 | +" lock` (GIL) is disabled. Free-threaded execution allows for full " |
| 35 | +"utilization of the available processing power by running threads in parallel" |
| 36 | +" on available CPU cores. While not all software will benefit from this " |
| 37 | +"automatically, programs designed with threading in mind will run faster on " |
| 38 | +"multi-core hardware." |
| 39 | +msgstr "" |
| 40 | +"从 3.13 版开始,CPython 实验性地支持 :term:`free threading` (自由线程) 的 Python 构建,其禁用 " |
| 41 | +":term:`global interpreter lock` (GIL)。自由线程化的执行允许在可用的 CPU " |
| 42 | +"上并行运行线程,充分利用可用的处理能力。尽管并非所有软件都能自动地从中受益,但是考虑到线程设计的程序在多核硬件上运行速度会更快。" |
| 43 | + |
| 44 | +#: ../../howto/free-threading-python.rst:14 |
| 45 | +msgid "" |
| 46 | +"**The free-threaded mode is experimental** and work is ongoing to improve " |
| 47 | +"it: expect some bugs and a substantial single-threaded performance hit." |
| 48 | +msgstr "**自由线程模式是实验性的**,改进工作正在进行中:预计会出现一些错误,单线程性能也会受到很大影响。" |
| 49 | + |
| 50 | +#: ../../howto/free-threading-python.rst:17 |
| 51 | +msgid "" |
| 52 | +"This document describes the implications of free threading for Python code." |
| 53 | +" See :ref:`freethreading-extensions-howto` for information on how to write " |
| 54 | +"C extensions that support the free-threaded build." |
| 55 | +msgstr "" |
| 56 | +"本文档描述了自由线程对 Python 代码的影响。 请参阅 :ref:`freethreading-extensions-howto` " |
| 57 | +"了解如何编写支持自由线程构建的 C 扩展。" |
| 58 | + |
| 59 | +#: ../../howto/free-threading-python.rst:23 |
| 60 | +msgid "" |
| 61 | +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " |
| 62 | +"overall description of free-threaded Python." |
| 63 | +msgstr ":pep:`703` —— 查阅《在 CPython 中使全局解释器锁成为可选项》以了解对自由线程 Python 的整体描述。" |
| 64 | + |
| 65 | +#: ../../howto/free-threading-python.rst:28 |
| 66 | +msgid "Installation" |
| 67 | +msgstr "安装" |
| 68 | + |
| 69 | +#: ../../howto/free-threading-python.rst:30 |
| 70 | +msgid "" |
| 71 | +"Starting with Python 3.13, the official macOS and Windows installers " |
| 72 | +"optionally support installing free-threaded Python binaries. The installers" |
| 73 | +" are available at https://www.python.org/downloads/." |
| 74 | +msgstr "" |
| 75 | +"从 Python 3.13 开始,官方 macOS 和 Windows 安装器提供了对可选安装自由线程 Python 二进制文件的支持。 安装器可在 " |
| 76 | +"https://www.python.org/downloads/ 获取。" |
| 77 | + |
| 78 | +#: ../../howto/free-threading-python.rst:34 |
| 79 | +msgid "" |
| 80 | +"For information on other platforms, see the `Installing a Free-Threaded " |
| 81 | +"Python <https://py-free-threading.github.io/installing_cpython/>`_, a " |
| 82 | +"community-maintained installation guide for installing free-threaded Python." |
| 83 | +msgstr "" |
| 84 | +"有关其他平台的描述,请参阅 `安装自由线程 Python <https://py-free-" |
| 85 | +"threading.github.io/installing_cpython/>`_,这是一份由社区维护的,用于安装自由线程 Python 的安装指南。" |
| 86 | + |
| 87 | +#: ../../howto/free-threading-python.rst:38 |
| 88 | +msgid "" |
| 89 | +"When building CPython from source, the :option:`--disable-gil` configure " |
| 90 | +"option should be used to build a free-threaded Python interpreter." |
| 91 | +msgstr "当从源码构建 CPython 时,应使用 :option:`--disable-gil` 配置选项以构建自由线程 Python 解释器" |
| 92 | + |
| 93 | +#: ../../howto/free-threading-python.rst:43 |
| 94 | +msgid "Identifying free-threaded Python" |
| 95 | +msgstr "识别自由线程 Python" |
| 96 | + |
| 97 | +#: ../../howto/free-threading-python.rst:45 |
| 98 | +msgid "" |
| 99 | +"To check if the current interpreter supports free-threading, :option:`python" |
| 100 | +" -VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " |
| 101 | +"build\". The new :func:`sys._is_gil_enabled` function can be used to check " |
| 102 | +"whether the GIL is actually disabled in the running process." |
| 103 | +msgstr "" |
| 104 | +"要检查当前解释器是否支持自由线程,查看 :option:`python -VV <-V>` 和 :attr:`sys.version` 是否包含 " |
| 105 | +"\"experimental free-threading build\"。新的 :func:`sys._is_gil_enabled` " |
| 106 | +"函数可用于检查在运行进程中全局解释器锁是否确实被关闭。" |
| 107 | + |
| 108 | +#: ../../howto/free-threading-python.rst:50 |
| 109 | +msgid "" |
| 110 | +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable" |
| 111 | +" can be used to determine whether the build supports free threading. If the" |
| 112 | +" variable is set to ``1``, then the build supports free threading. This is " |
| 113 | +"the recommended mechanism for decisions related to the build configuration." |
| 114 | +msgstr "" |
| 115 | + |
| 116 | +#: ../../howto/free-threading-python.rst:57 |
| 117 | +msgid "The global interpreter lock in free-threaded Python" |
| 118 | +msgstr "" |
| 119 | + |
| 120 | +#: ../../howto/free-threading-python.rst:59 |
| 121 | +msgid "" |
| 122 | +"Free-threaded builds of CPython support optionally running with the GIL " |
| 123 | +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " |
| 124 | +"the command-line option :option:`-X gil`." |
| 125 | +msgstr "" |
| 126 | + |
| 127 | +#: ../../howto/free-threading-python.rst:63 |
| 128 | +msgid "" |
| 129 | +"The GIL may also automatically be enabled when importing a C-API extension " |
| 130 | +"module that is not explicitly marked as supporting free threading. A " |
| 131 | +"warning will be printed in this case." |
| 132 | +msgstr "" |
| 133 | + |
| 134 | +#: ../../howto/free-threading-python.rst:67 |
| 135 | +msgid "" |
| 136 | +"In addition to individual package documentation, the following websites " |
| 137 | +"track the status of popular packages support for free threading:" |
| 138 | +msgstr "" |
| 139 | + |
| 140 | +#: ../../howto/free-threading-python.rst:70 |
| 141 | +msgid "https://py-free-threading.github.io/tracking/" |
| 142 | +msgstr "https://py-free-threading.github.io/tracking/" |
| 143 | + |
| 144 | +#: ../../howto/free-threading-python.rst:71 |
| 145 | +msgid "https://hugovk.github.io/free-threaded-wheels/" |
| 146 | +msgstr "https://hugovk.github.io/free-threaded-wheels/" |
| 147 | + |
| 148 | +#: ../../howto/free-threading-python.rst:75 |
| 149 | +msgid "Thread safety" |
| 150 | +msgstr "线程安全" |
| 151 | + |
| 152 | +#: ../../howto/free-threading-python.rst:77 |
| 153 | +msgid "" |
| 154 | +"The free-threaded build of CPython aims to provide similar thread-safety " |
| 155 | +"behavior at the Python level to the default GIL-enabled build. Built-in " |
| 156 | +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks" |
| 157 | +" to protect against concurrent modifications in ways that behave similarly " |
| 158 | +"to the GIL. However, Python has not historically guaranteed specific " |
| 159 | +"behavior for concurrent modifications to these built-in types, so this " |
| 160 | +"should be treated as a description of the current implementation, not a " |
| 161 | +"guarantee of current or future behavior." |
| 162 | +msgstr "" |
| 163 | + |
| 164 | +#: ../../howto/free-threading-python.rst:88 |
| 165 | +msgid "" |
| 166 | +"It's recommended to use the :class:`threading.Lock` or other synchronization" |
| 167 | +" primitives instead of relying on the internal locks of built-in types, when" |
| 168 | +" possible." |
| 169 | +msgstr "" |
| 170 | + |
| 171 | +#: ../../howto/free-threading-python.rst:94 |
| 172 | +msgid "Known limitations" |
| 173 | +msgstr "已知的限制" |
| 174 | + |
| 175 | +#: ../../howto/free-threading-python.rst:96 |
| 176 | +msgid "" |
| 177 | +"This section describes known limitations of the free-threaded CPython build." |
| 178 | +msgstr "本节介绍自由线程 CPython 构建的已知限制。" |
| 179 | + |
| 180 | +#: ../../howto/free-threading-python.rst:99 |
| 181 | +msgid "Immortalization" |
| 182 | +msgstr "永生化" |
| 183 | + |
| 184 | +#: ../../howto/free-threading-python.rst:101 |
| 185 | +msgid "" |
| 186 | +"The free-threaded build of the 3.13 release makes some objects " |
| 187 | +":term:`immortal`. Immortal objects are not deallocated and have reference " |
| 188 | +"counts that are never modified. This is done to avoid reference count " |
| 189 | +"contention that would prevent efficient multi-threaded scaling." |
| 190 | +msgstr "" |
| 191 | + |
| 192 | +#: ../../howto/free-threading-python.rst:106 |
| 193 | +msgid "" |
| 194 | +"An object will be made immortal when a new thread is started for the first " |
| 195 | +"time after the main thread is running. The following objects are " |
| 196 | +"immortalized:" |
| 197 | +msgstr "" |
| 198 | + |
| 199 | +#: ../../howto/free-threading-python.rst:109 |
| 200 | +msgid "" |
| 201 | +":ref:`function <user-defined-funcs>` objects declared at the module level" |
| 202 | +msgstr "在模块中声明的 :ref:`函数 <user-defined-funcs>` 对象" |
| 203 | + |
| 204 | +#: ../../howto/free-threading-python.rst:110 |
| 205 | +msgid ":ref:`method <instance-methods>` descriptors" |
| 206 | +msgstr ":ref:`方法 <instance-methods>` 描述器" |
| 207 | + |
| 208 | +#: ../../howto/free-threading-python.rst:111 |
| 209 | +msgid ":ref:`code <code-objects>` objects" |
| 210 | +msgstr ":ref:`代码对象 <code-objects>`" |
| 211 | + |
| 212 | +#: ../../howto/free-threading-python.rst:112 |
| 213 | +msgid ":term:`module` objects and their dictionaries" |
| 214 | +msgstr ":term:`module` 对象及其字典" |
| 215 | + |
| 216 | +#: ../../howto/free-threading-python.rst:113 |
| 217 | +msgid ":ref:`classes <classes>` (type objects)" |
| 218 | +msgstr ":ref:`类 <classes>` (类型对象)" |
| 219 | + |
| 220 | +#: ../../howto/free-threading-python.rst:115 |
| 221 | +msgid "" |
| 222 | +"Because immortal objects are never deallocated, applications that create " |
| 223 | +"many objects of these types may see increased memory usage. This is " |
| 224 | +"expected to be addressed in the 3.14 release." |
| 225 | +msgstr "" |
| 226 | + |
| 227 | +#: ../../howto/free-threading-python.rst:119 |
| 228 | +msgid "" |
| 229 | +"Additionally, numeric and string literals in the code as well as strings " |
| 230 | +"returned by :func:`sys.intern` are also immortalized. This behavior is " |
| 231 | +"expected to remain in the 3.14 free-threaded build." |
| 232 | +msgstr "" |
| 233 | + |
| 234 | +#: ../../howto/free-threading-python.rst:125 |
| 235 | +msgid "Frame objects" |
| 236 | +msgstr "帧对象" |
| 237 | + |
| 238 | +#: ../../howto/free-threading-python.rst:127 |
| 239 | +msgid "" |
| 240 | +"It is not safe to access :ref:`frame <frame-objects>` objects from other " |
| 241 | +"threads and doing so may cause your program to crash . This means that " |
| 242 | +":func:`sys._current_frames` is generally not safe to use in a free-threaded " |
| 243 | +"build. Functions like :func:`inspect.currentframe` and " |
| 244 | +":func:`sys._getframe` are generally safe as long as the resulting frame " |
| 245 | +"object is not passed to another thread." |
| 246 | +msgstr "" |
| 247 | + |
| 248 | +#: ../../howto/free-threading-python.rst:135 |
| 249 | +msgid "Iterators" |
| 250 | +msgstr "迭代器" |
| 251 | + |
| 252 | +#: ../../howto/free-threading-python.rst:137 |
| 253 | +msgid "" |
| 254 | +"Sharing the same iterator object between multiple threads is generally not " |
| 255 | +"safe and threads may see duplicate or missing elements when iterating or " |
| 256 | +"crash the interpreter." |
| 257 | +msgstr "" |
| 258 | + |
| 259 | +#: ../../howto/free-threading-python.rst:143 |
| 260 | +msgid "Single-threaded performance" |
| 261 | +msgstr "单线程性能" |
| 262 | + |
| 263 | +#: ../../howto/free-threading-python.rst:145 |
| 264 | +msgid "" |
| 265 | +"The free-threaded build has additional overhead when executing Python code " |
| 266 | +"compared to the default GIL-enabled build. In 3.13, this overhead is about " |
| 267 | +"40% on the `pyperformance <https://pyperformance.readthedocs.io/>`_ suite. " |
| 268 | +"Programs that spend most of their time in C extensions or I/O will see less " |
| 269 | +"of an impact. The largest impact is because the specializing adaptive " |
| 270 | +"interpreter (:pep:`659`) is disabled in the free-threaded build. We expect " |
| 271 | +"to re-enable it in a thread-safe way in the 3.14 release. This overhead is " |
| 272 | +"expected to be reduced in upcoming Python release. We are aiming for an " |
| 273 | +"overhead of 10% or less on the pyperformance suite compared to the default " |
| 274 | +"GIL-enabled build." |
| 275 | +msgstr "" |
0 commit comments