-
-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathfree-threading-python.po
More file actions
291 lines (252 loc) · 14.5 KB
/
Copy pathfree-threading-python.po
File metadata and controls
291 lines (252 loc) · 14.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2025, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-23 14:55+0000\n"
"PO-Revision-Date: 2025-09-15 01:03+0000\n"
"Last-Translator: python-doc bot, 2025\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../howto/free-threading-python.rst:5
msgid "Python experimental support for free threading"
msgstr "Python 对自由线程的实验性支持"
#: ../../howto/free-threading-python.rst:7
msgid ""
"Starting with the 3.13 release, CPython has experimental support for a build"
" of Python called :term:`free threading` where the :term:`global interpreter"
" lock` (GIL) is disabled. Free-threaded execution allows for full "
"utilization of the available processing power by running threads in parallel"
" on available CPU cores. While not all software will benefit from this "
"automatically, programs designed with threading in mind will run faster on "
"multi-core hardware."
msgstr ""
"从 3.13 版开始,CPython 实验性地支持 :term:`free threading` (自由线程) 的 Python 构建,其禁用 "
":term:`global interpreter lock` (GIL)。自由线程化的执行允许在可用的 CPU "
"上并行运行线程,充分利用可用的处理能力。尽管并非所有软件都能自动地从中受益,但是考虑到线程设计的程序在多核硬件上运行速度会更快。"
#: ../../howto/free-threading-python.rst:14
msgid ""
"**The free-threaded mode is experimental** and work is ongoing to improve "
"it: expect some bugs and a substantial single-threaded performance hit."
msgstr "**自由线程模式是实验性的**,改进工作正在进行中:预计会出现一些错误,单线程性能也会受到很大影响。"
#: ../../howto/free-threading-python.rst:17
msgid ""
"This document describes the implications of free threading for Python code."
" See :ref:`freethreading-extensions-howto` for information on how to write "
"C extensions that support the free-threaded build."
msgstr ""
"本文档描述了自由线程对 Python 代码的影响。 请参阅 :ref:`freethreading-extensions-howto` "
"了解如何编写支持自由线程构建的 C 扩展。"
#: ../../howto/free-threading-python.rst:23
msgid ""
":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an "
"overall description of free-threaded Python."
msgstr ":pep:`703` —— 查阅《在 CPython 中使全局解释器锁成为可选项》以了解对自由线程 Python 的整体描述。"
#: ../../howto/free-threading-python.rst:28
msgid "Installation"
msgstr "安装"
#: ../../howto/free-threading-python.rst:30
msgid ""
"Starting with Python 3.13, the official macOS and Windows installers "
"optionally support installing free-threaded Python binaries. The installers"
" are available at https://www.python.org/downloads/."
msgstr ""
"从 Python 3.13 开始,官方 macOS 和 Windows 安装器提供了对可选安装自由线程 Python 二进制文件的支持。 安装器可在 "
"https://www.python.org/downloads/ 获取。"
#: ../../howto/free-threading-python.rst:34
msgid ""
"For information on other platforms, see the `Installing a Free-Threaded "
"Python <https://py-free-threading.github.io/installing-cpython/>`_, a "
"community-maintained installation guide for installing free-threaded Python."
msgstr ""
"有关其他平台的信息,请参阅 `Installing a Free-Threaded Python <https://py-free-"
"threading.github.io/installing-cpython/>`_,这是一份由社区维护的针对安装自由线程版 Python 的安装指南。"
#: ../../howto/free-threading-python.rst:38
msgid ""
"When building CPython from source, the :option:`--disable-gil` configure "
"option should be used to build a free-threaded Python interpreter."
msgstr "当从源码构建 CPython 时,应使用 :option:`--disable-gil` 配置选项以构建自由线程 Python 解释器"
#: ../../howto/free-threading-python.rst:43
msgid "Identifying free-threaded Python"
msgstr "识别自由线程 Python"
#: ../../howto/free-threading-python.rst:45
msgid ""
"To check if the current interpreter supports free-threading, :option:`python"
" -VV <-V>` and :data:`sys.version` contain \"experimental free-threading "
"build\". The new :func:`sys._is_gil_enabled` function can be used to check "
"whether the GIL is actually disabled in the running process."
msgstr ""
"要判断当前解释器是否支持自由线程,可检查 :option:`python -VV <-V>` 和 :data:`sys.version` 是否包含 "
"\"experimental free-threading build\"。 新的 :func:`sys._is_gil_enabled` "
"函数可用于检查在运行进程中 GIL 是否确实被关闭。"
#: ../../howto/free-threading-python.rst:50
msgid ""
"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable"
" can be used to determine whether the build supports free threading. If the"
" variable is set to ``1``, then the build supports free threading. This is "
"the recommended mechanism for decisions related to the build configuration."
msgstr ""
"``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` 配置变量可用于确定构建是否支持自由线程 。 "
"如果该变量设置为``1`` ,则构建支持自由线程。这是与构建配置相关的决策的推荐机制。"
#: ../../howto/free-threading-python.rst:57
msgid "The global interpreter lock in free-threaded Python"
msgstr "自由线程版 Python 中的全局解释器锁"
#: ../../howto/free-threading-python.rst:59
msgid ""
"Free-threaded builds of CPython support optionally running with the GIL "
"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or "
"the command-line option :option:`-X gil`."
msgstr ""
"CPython 的自由线程构建版支持在运行时使用环境变量 :envvar:`PYTHON_GIL` 或命令行选项 :option:`-X gil` "
"选择性地启用 GIL。"
#: ../../howto/free-threading-python.rst:63
msgid ""
"The GIL may also automatically be enabled when importing a C-API extension "
"module that is not explicitly marked as supporting free threading. A "
"warning will be printed in this case."
msgstr "GIL 也可能在导入未显式标记为支持自由线程模式的 C-API 扩展模块时被自动启用。 在这种情况下将会打印一条警告。"
#: ../../howto/free-threading-python.rst:67
msgid ""
"In addition to individual package documentation, the following websites "
"track the status of popular packages support for free threading:"
msgstr "在单独软件包的文档以外,还有下列网站在追踪热门软件包对自由线程模式的支持状态:"
#: ../../howto/free-threading-python.rst:70
msgid "https://py-free-threading.github.io/tracking/"
msgstr "https://py-free-threading.github.io/tracking/"
#: ../../howto/free-threading-python.rst:71
msgid "https://hugovk.github.io/free-threaded-wheels/"
msgstr "https://hugovk.github.io/free-threaded-wheels/"
#: ../../howto/free-threading-python.rst:75
msgid "Thread safety"
msgstr "线程安全"
#: ../../howto/free-threading-python.rst:77
msgid ""
"The free-threaded build of CPython aims to provide similar thread-safety "
"behavior at the Python level to the default GIL-enabled build. Built-in "
"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks"
" to protect against concurrent modifications in ways that behave similarly "
"to the GIL. However, Python has not historically guaranteed specific "
"behavior for concurrent modifications to these built-in types, so this "
"should be treated as a description of the current implementation, not a "
"guarantee of current or future behavior."
msgstr ""
"自由线程构建的 CPython 旨在 Python 层级提供与默认全局解释器锁启用构建相似的线程安全行为。内置类型(如 :class:`dict` 、 "
":class:`list` 和 :class:`set` 等)使用内部上锁来防止并发修改,其行为方式与全局解释器锁相似。 但是,Python "
"历来不对这些内置类型的并发修改提供特定的行为提供保证,因此这应被视为对当前实现的描述,而不是对当前或未来行为的保证。"
#: ../../howto/free-threading-python.rst:88
msgid ""
"It's recommended to use the :class:`threading.Lock` or other synchronization"
" primitives instead of relying on the internal locks of built-in types, when"
" possible."
msgstr "建议尽可能使用 :class:`threading.Lock` 或其他同步的原语,而不是依赖内置类型的内部上锁 。"
#: ../../howto/free-threading-python.rst:94
msgid "Known limitations"
msgstr "已知的限制"
#: ../../howto/free-threading-python.rst:96
msgid ""
"This section describes known limitations of the free-threaded CPython build."
msgstr "本节介绍自由线程 CPython 构建的已知限制。"
#: ../../howto/free-threading-python.rst:99
msgid "Immortalization"
msgstr "永生化"
#: ../../howto/free-threading-python.rst:101
msgid ""
"The free-threaded build of the 3.13 release makes some objects "
":term:`immortal`. Immortal objects are not deallocated and have reference "
"counts that are never modified. This is done to avoid reference count "
"contention that would prevent efficient multi-threaded scaling."
msgstr ""
"3.13 版本的自由线程构建使某些对象 :term:`immortal`。 永生对象不会被重新分配,其引用计数永远不会被修改。 "
"这样做是为了避免引用计数发生争夺,以免妨碍高效的多线程扩展。"
#: ../../howto/free-threading-python.rst:106
msgid ""
"An object will be made immortal when a new thread is started for the first "
"time after the main thread is running. The following objects are "
"immortalized:"
msgstr "当主线程运行后首次启动新的线程时,对象将被永生化。 以下对象将被永生化:"
#: ../../howto/free-threading-python.rst:109
msgid ""
":ref:`function <user-defined-funcs>` objects declared at the module level"
msgstr "在模块中声明的 :ref:`函数 <user-defined-funcs>` 对象"
#: ../../howto/free-threading-python.rst:110
msgid ":ref:`method <instance-methods>` descriptors"
msgstr ":ref:`方法 <instance-methods>` 描述器"
#: ../../howto/free-threading-python.rst:111
msgid ":ref:`code <code-objects>` objects"
msgstr ":ref:`代码对象 <code-objects>`"
#: ../../howto/free-threading-python.rst:112
msgid ":term:`module` objects and their dictionaries"
msgstr ":term:`module` 对象及其字典"
#: ../../howto/free-threading-python.rst:113
msgid ":ref:`classes <classes>` (type objects)"
msgstr ":ref:`类 <classes>` (类型对象)"
#: ../../howto/free-threading-python.rst:115
msgid ""
"Because immortal objects are never deallocated, applications that create "
"many objects of these types may see increased memory usage. This is "
"expected to be addressed in the 3.14 release."
msgstr "由于永生对象永远不会被重新分配,因此应用如果创建了许多此类对象,可能会增加内存使用。预计 3.14 版将解决这个问题。"
#: ../../howto/free-threading-python.rst:119
msgid ""
"Additionally, numeric and string literals in the code as well as strings "
"returned by :func:`sys.intern` are also immortalized. This behavior is "
"expected to remain in the 3.14 free-threaded build."
msgstr ""
"此外,代码中的数字和字符串字面值以及 :func:`sys.intern` 返回的字符串也将永久化。 预计在 3.14 自由线程构建中将保留这一行为 。"
#: ../../howto/free-threading-python.rst:125
msgid "Frame objects"
msgstr "帧对象"
#: ../../howto/free-threading-python.rst:127
msgid ""
"It is not safe to access :ref:`frame <frame-objects>` objects from other "
"threads and doing so may cause your program to crash . This means that "
":func:`sys._current_frames` is generally not safe to use in a free-threaded "
"build. Functions like :func:`inspect.currentframe` and "
":func:`sys._getframe` are generally safe as long as the resulting frame "
"object is not passed to another thread."
msgstr ""
"从其他线程访问 :ref:`帧 <frame-objects>` 对象是不安全的,这样做可能会导致程序崩溃。 这意味着,在自由线程构建中使用 "
":func:`sys._current_frames` 一般是不安全的。 函数(如 :func:`inspect.currentframe` 和 "
":func:`sys._getframe` 等)只要不将生成的帧对象传递给另一个线程,一般都是安全的。"
#: ../../howto/free-threading-python.rst:135
msgid "Iterators"
msgstr "迭代器"
#: ../../howto/free-threading-python.rst:137
msgid ""
"Sharing the same iterator object between multiple threads is generally not "
"safe and threads may see duplicate or missing elements when iterating or "
"crash the interpreter."
msgstr "在多个线程之间共享同一个迭代器对象通常是不安全的,线程在迭代时可能会出现元素重复或缺失的情况,或使解释器崩溃。"
#: ../../howto/free-threading-python.rst:143
msgid "Single-threaded performance"
msgstr "单线程性能"
#: ../../howto/free-threading-python.rst:145
msgid ""
"The free-threaded build has additional overhead when executing Python code "
"compared to the default GIL-enabled build. In 3.13, this overhead is about "
"40% on the `pyperformance <https://pyperformance.readthedocs.io/>`_ suite. "
"Programs that spend most of their time in C extensions or I/O will see less "
"of an impact. The largest impact is because the specializing adaptive "
"interpreter (:pep:`659`) is disabled in the free-threaded build. We expect "
"to re-enable it in a thread-safe way in the 3.14 release. This overhead is "
"expected to be reduced in upcoming Python release. We are aiming for an "
"overhead of 10% or less on the pyperformance suite compared to the default "
"GIL-enabled build."
msgstr ""
"与启用默认全局解释器锁的构建相比,自由线程构建在执行 Python 代码时有额外的开销。 在 3.13 中,`pyperformance "
"<https://pyperformance.readthedocs.io/>`_ 套件的开销约为 40%。大部分时间花在 C 扩展或 I/O "
"上的程序受到的影响较小。影响最大的原因是在自由线程构建中禁用了特化自适应解释器 (:pep:`659`) 。 我们希望在 3.14 "
"中以线程安全的方式重新启用它。在即将发布的 Python 版本中,这一开销有望减少。 "
"我们的目标是,与启用默认全局解释器锁的构建相比,pyperformance 套件的开销不超过 10%。"