Skip to content

Commit 2013b2a

Browse files
sync with cpython 206f1966
1 parent bd8aaf5 commit 2013b2a

File tree

2 files changed

+322
-357
lines changed

2 files changed

+322
-357
lines changed

howto/free-threading-python.po

Lines changed: 75 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.14\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-11-07 00:14+0000\n"
10+
"POT-Creation-Date: 2025-12-03 00:14+0000\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -34,107 +34,105 @@ msgstr ""
3434

3535
#: ../../howto/free-threading-python.rst:14
3636
msgid ""
37-
"The free-threaded mode is working and continues to be improved, but there is "
38-
"some additional overhead in single-threaded workloads compared to the "
39-
"regular build. Additionally, third-party packages, in particular ones with "
40-
"an :term:`extension module`, may not be ready for use in a free-threaded "
41-
"build, and will re-enable the :term:`GIL`."
37+
"Some third-party packages, in particular ones with an :term:`extension "
38+
"module`, may not be ready for use in a free-threaded build, and will re-"
39+
"enable the :term:`GIL`."
4240
msgstr ""
4341

44-
#: ../../howto/free-threading-python.rst:20
42+
#: ../../howto/free-threading-python.rst:18
4543
msgid ""
4644
"This document describes the implications of free threading for Python code. "
4745
"See :ref:`freethreading-extensions-howto` for information on how to write C "
4846
"extensions that support the free-threaded build."
4947
msgstr ""
5048

51-
#: ../../howto/free-threading-python.rst:26
49+
#: ../../howto/free-threading-python.rst:24
5250
msgid ""
5351
":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an "
5452
"overall description of free-threaded Python."
5553
msgstr ""
5654

57-
#: ../../howto/free-threading-python.rst:31
55+
#: ../../howto/free-threading-python.rst:29
5856
msgid "Installation"
5957
msgstr "安裝"
6058

61-
#: ../../howto/free-threading-python.rst:33
59+
#: ../../howto/free-threading-python.rst:31
6260
msgid ""
6361
"Starting with Python 3.13, the official macOS and Windows installers "
6462
"optionally support installing free-threaded Python binaries. The installers "
6563
"are available at https://www.python.org/downloads/."
6664
msgstr ""
6765

68-
#: ../../howto/free-threading-python.rst:37
66+
#: ../../howto/free-threading-python.rst:35
6967
msgid ""
7068
"For information on other platforms, see the `Installing a Free-Threaded "
7169
"Python <https://py-free-threading.github.io/installing-cpython/>`_, a "
7270
"community-maintained installation guide for installing free-threaded Python."
7371
msgstr ""
7472

75-
#: ../../howto/free-threading-python.rst:41
73+
#: ../../howto/free-threading-python.rst:39
7674
msgid ""
7775
"When building CPython from source, the :option:`--disable-gil` configure "
7876
"option should be used to build a free-threaded Python interpreter."
7977
msgstr ""
8078

81-
#: ../../howto/free-threading-python.rst:46
79+
#: ../../howto/free-threading-python.rst:44
8280
msgid "Identifying free-threaded Python"
8381
msgstr ""
8482

85-
#: ../../howto/free-threading-python.rst:48
83+
#: ../../howto/free-threading-python.rst:46
8684
msgid ""
8785
"To check if the current interpreter supports free-threading, :option:`python "
8886
"-VV <-V>` and :data:`sys.version` contain \"free-threading build\". The new :"
8987
"func:`sys._is_gil_enabled` function can be used to check whether the GIL is "
9088
"actually disabled in the running process."
9189
msgstr ""
9290

93-
#: ../../howto/free-threading-python.rst:53
91+
#: ../../howto/free-threading-python.rst:51
9492
msgid ""
9593
"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable "
9694
"can be used to determine whether the build supports free threading. If the "
9795
"variable is set to ``1``, then the build supports free threading. This is "
9896
"the recommended mechanism for decisions related to the build configuration."
9997
msgstr ""
10098

101-
#: ../../howto/free-threading-python.rst:60
99+
#: ../../howto/free-threading-python.rst:58
102100
msgid "The global interpreter lock in free-threaded Python"
103101
msgstr ""
104102

105-
#: ../../howto/free-threading-python.rst:62
103+
#: ../../howto/free-threading-python.rst:60
106104
msgid ""
107105
"Free-threaded builds of CPython support optionally running with the GIL "
108106
"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or "
109107
"the command-line option :option:`-X gil`."
110108
msgstr ""
111109

112-
#: ../../howto/free-threading-python.rst:66
110+
#: ../../howto/free-threading-python.rst:64
113111
msgid ""
114112
"The GIL may also automatically be enabled when importing a C-API extension "
115113
"module that is not explicitly marked as supporting free threading. A "
116114
"warning will be printed in this case."
117115
msgstr ""
118116

119-
#: ../../howto/free-threading-python.rst:70
117+
#: ../../howto/free-threading-python.rst:68
120118
msgid ""
121119
"In addition to individual package documentation, the following websites "
122120
"track the status of popular packages support for free threading:"
123121
msgstr ""
124122

125-
#: ../../howto/free-threading-python.rst:73
123+
#: ../../howto/free-threading-python.rst:71
126124
msgid "https://py-free-threading.github.io/tracking/"
127125
msgstr "https://py-free-threading.github.io/tracking/"
128126

129-
#: ../../howto/free-threading-python.rst:74
127+
#: ../../howto/free-threading-python.rst:72
130128
msgid "https://hugovk.github.io/free-threaded-wheels/"
131129
msgstr "https://hugovk.github.io/free-threaded-wheels/"
132130

133-
#: ../../howto/free-threading-python.rst:78
131+
#: ../../howto/free-threading-python.rst:76
134132
msgid "Thread safety"
135133
msgstr "執行緒安全"
136134

137-
#: ../../howto/free-threading-python.rst:80
135+
#: ../../howto/free-threading-python.rst:78
138136
msgid ""
139137
"The free-threaded build of CPython aims to provide similar thread-safety "
140138
"behavior at the Python level to the default GIL-enabled build. Built-in "
@@ -146,140 +144,98 @@ msgid ""
146144
"current or future behavior."
147145
msgstr ""
148146

149-
#: ../../howto/free-threading-python.rst:91
147+
#: ../../howto/free-threading-python.rst:89
150148
msgid ""
151149
"It's recommended to use the :class:`threading.Lock` or other synchronization "
152150
"primitives instead of relying on the internal locks of built-in types, when "
153151
"possible."
154152
msgstr ""
155153

156-
#: ../../howto/free-threading-python.rst:97
154+
#: ../../howto/free-threading-python.rst:95
157155
msgid "Known limitations"
158156
msgstr "已知限制"
159157

160-
#: ../../howto/free-threading-python.rst:99
158+
#: ../../howto/free-threading-python.rst:97
161159
msgid ""
162160
"This section describes known limitations of the free-threaded CPython build."
163161
msgstr ""
164162

165-
#: ../../howto/free-threading-python.rst:102
163+
#: ../../howto/free-threading-python.rst:100
166164
msgid "Immortalization"
167165
msgstr "不滅化 (Immortalization)"
168166

169-
#: ../../howto/free-threading-python.rst:104
167+
#: ../../howto/free-threading-python.rst:102
170168
msgid ""
171-
"The free-threaded build of the 3.13 release makes some objects :term:"
172-
"`immortal`. Immortal objects are not deallocated and have reference counts "
173-
"that are never modified. This is done to avoid reference count contention "
174-
"that would prevent efficient multi-threaded scaling."
169+
"In the free-threaded build, some objects are :term:`immortal`. Immortal "
170+
"objects are not deallocated and have reference counts that are never "
171+
"modified. This is done to avoid reference count contention that would "
172+
"prevent efficient multi-threaded scaling."
175173
msgstr ""
176174

177-
#: ../../howto/free-threading-python.rst:109
178-
msgid ""
179-
"An object will be made immortal when a new thread is started for the first "
180-
"time after the main thread is running. The following objects are "
181-
"immortalized:"
175+
#: ../../howto/free-threading-python.rst:107
176+
msgid "As of the 3.14 release, immortalization is limited to:"
182177
msgstr ""
183178

184-
#: ../../howto/free-threading-python.rst:112
185-
msgid ""
186-
":ref:`function <user-defined-funcs>` objects declared at the module level"
187-
msgstr "在模組層級宣告的\\ :ref:`函式 <user-defined-funcs>`\\ 物件"
188-
189-
#: ../../howto/free-threading-python.rst:113
190-
msgid ":ref:`method <instance-methods>` descriptors"
191-
msgstr ":ref:`方法 <instance-methods>`\\ 描述器"
192-
193-
#: ../../howto/free-threading-python.rst:114
194-
msgid ":ref:`code <code-objects>` objects"
195-
msgstr ":ref:`程式碼 <code-objects>`\\ 物件"
196-
197-
#: ../../howto/free-threading-python.rst:115
198-
msgid ":term:`module` objects and their dictionaries"
199-
msgstr ":term:`模組 <module>`\\ 物件及其字典"
200-
201-
#: ../../howto/free-threading-python.rst:116
202-
msgid ":ref:`classes <classes>` (type objects)"
203-
msgstr ":ref:`類別 <classes>`\\ (型別物件)"
204-
205-
#: ../../howto/free-threading-python.rst:118
179+
#: ../../howto/free-threading-python.rst:109
206180
msgid ""
207-
"Because immortal objects are never deallocated, applications that create "
208-
"many objects of these types may see increased memory usage under Python "
209-
"3.13. This has been addressed in the 3.14 release, where the aforementioned "
210-
"objects use deferred reference counting to avoid reference count contention."
181+
"Code constants: numeric literals, string literals, and tuple literals "
182+
"composed of other constants."
211183
msgstr ""
212184

213-
#: ../../howto/free-threading-python.rst:123
214-
msgid ""
215-
"Additionally, numeric and string literals in the code as well as strings "
216-
"returned by :func:`sys.intern` are also immortalized in the 3.13 release. "
217-
"This behavior is part of the 3.14 release as well and it is expected to "
218-
"remain in future free-threaded builds."
185+
#: ../../howto/free-threading-python.rst:111
186+
msgid "Strings interned by :func:`sys.intern`."
219187
msgstr ""
220188

221-
#: ../../howto/free-threading-python.rst:130
189+
#: ../../howto/free-threading-python.rst:115
222190
msgid "Frame objects"
223191
msgstr ""
224192

225-
#: ../../howto/free-threading-python.rst:132
193+
#: ../../howto/free-threading-python.rst:117
226194
msgid ""
227-
"It is not safe to access :ref:`frame <frame-objects>` objects from other "
228-
"threads and doing so may cause your program to crash . This means that :"
229-
"func:`sys._current_frames` is generally not safe to use in a free-threaded "
230-
"build. Functions like :func:`inspect.currentframe` and :func:`sys."
231-
"_getframe` are generally safe as long as the resulting frame object is not "
232-
"passed to another thread."
195+
"It is not safe to access :attr:`frame.f_locals` from a :ref:`frame <frame-"
196+
"objects>` object if that frame is currently executing in another thread, and "
197+
"doing so may crash the interpreter."
233198
msgstr ""
234199

235-
#: ../../howto/free-threading-python.rst:140
200+
#: ../../howto/free-threading-python.rst:123
236201
msgid "Iterators"
237202
msgstr "疊代器"
238203

239-
#: ../../howto/free-threading-python.rst:142
204+
#: ../../howto/free-threading-python.rst:125
240205
msgid ""
241-
"Sharing the same iterator object between multiple threads is generally not "
242-
"safe and threads may see duplicate or missing elements when iterating or "
243-
"crash the interpreter."
206+
"It is generally not thread-safe to access the same iterator object from "
207+
"multiple threads concurrently, and threads may see duplicate or missing "
208+
"elements."
244209
msgstr ""
245210

246-
#: ../../howto/free-threading-python.rst:148
211+
#: ../../howto/free-threading-python.rst:131
247212
msgid "Single-threaded performance"
248213
msgstr "單執行緒效能"
249214

250-
#: ../../howto/free-threading-python.rst:150
215+
#: ../../howto/free-threading-python.rst:133
251216
msgid ""
252217
"The free-threaded build has additional overhead when executing Python code "
253-
"compared to the default GIL-enabled build. In 3.13, this overhead is about "
254-
"40% on the `pyperformance <https://pyperformance.readthedocs.io/>`_ suite. "
255-
"Programs that spend most of their time in C extensions or I/O will see less "
256-
"of an impact. The largest impact is because the specializing adaptive "
257-
"interpreter (:pep:`659`) is disabled in the free-threaded build."
218+
"compared to the default GIL-enabled build. The amount of overhead depends "
219+
"on the workload and hardware. On the pyperformance benchmark suite, the "
220+
"average overhead ranges from about 1% on macOS aarch64 to 8% on x86-64 Linux "
221+
"systems."
258222
msgstr ""
259223

260-
#: ../../howto/free-threading-python.rst:157
261-
msgid ""
262-
"The specializing adaptive interpreter has been re-enabled in a thread-safe "
263-
"way in the 3.14 release. The performance penalty on single-threaded code in "
264-
"free-threaded mode is now roughly 5-10%, depending on the platform and C "
265-
"compiler used."
266-
msgstr ""
267-
268-
#: ../../howto/free-threading-python.rst:164
224+
#: ../../howto/free-threading-python.rst:141
269225
msgid "Behavioral changes"
270226
msgstr ""
271227

272-
#: ../../howto/free-threading-python.rst:166
228+
#: ../../howto/free-threading-python.rst:143
273229
msgid ""
274230
"This section describes CPython behavioural changes with the free-threaded "
275231
"build."
276232
msgstr ""
277233

278-
#: ../../howto/free-threading-python.rst:171
234+
#: ../../howto/free-threading-python.rst:148
279235
msgid "Context variables"
280236
msgstr ""
281237

282-
#: ../../howto/free-threading-python.rst:173
238+
#: ../../howto/free-threading-python.rst:150
283239
msgid ""
284240
"In the free-threaded build, the flag :data:`~sys.flags."
285241
"thread_inherit_context` is set to true by default which causes threads "
@@ -289,11 +245,11 @@ msgid ""
289245
"start with an empty :class:`~contextvars.Context()`."
290246
msgstr ""
291247

292-
#: ../../howto/free-threading-python.rst:183
248+
#: ../../howto/free-threading-python.rst:160
293249
msgid "Warning filters"
294250
msgstr ""
295251

296-
#: ../../howto/free-threading-python.rst:185
252+
#: ../../howto/free-threading-python.rst:162
297253
msgid ""
298254
"In the free-threaded build, the flag :data:`~sys.flags."
299255
"context_aware_warnings` is set to true by default. In the default GIL-"
@@ -303,3 +259,19 @@ msgid ""
303259
"catch_warnings` modifies the global filters list, which is not thread-safe. "
304260
"See the :mod:`warnings` module for more details."
305261
msgstr ""
262+
263+
#~ msgid ""
264+
#~ ":ref:`function <user-defined-funcs>` objects declared at the module level"
265+
#~ msgstr "在模組層級宣告的\\ :ref:`函式 <user-defined-funcs>`\\ 物件"
266+
267+
#~ msgid ":ref:`method <instance-methods>` descriptors"
268+
#~ msgstr ":ref:`方法 <instance-methods>`\\ 描述器"
269+
270+
#~ msgid ":ref:`code <code-objects>` objects"
271+
#~ msgstr ":ref:`程式碼 <code-objects>`\\ 物件"
272+
273+
#~ msgid ":term:`module` objects and their dictionaries"
274+
#~ msgstr ":term:`模組 <module>`\\ 物件及其字典"
275+
276+
#~ msgid ":ref:`classes <classes>` (type objects)"
277+
#~ msgstr ":ref:`類別 <classes>`\\ (型別物件)"

0 commit comments

Comments
 (0)