Skip to content

Commit f29a3f4

Browse files
sync with cpython c6f5a737
1 parent 2cb72fb commit f29a3f4

7 files changed

Lines changed: 2245 additions & 2157 deletions

File tree

c-api/lifecycle.po

Lines changed: 44 additions & 44 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: 2026-01-21 00:15+0000\n"
10+
"POT-Creation-Date: 2026-07-06 00:35+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-"
@@ -28,8 +28,8 @@ msgid ""
2828
"for the slots; instead, refer to the slot-specific documentation in :ref:"
2929
"`type-structs` for details about a particular slot."
3030
msgstr ""
31-
"此章節說明型別的插槽如何與物件的生命週期相關聯。它並非旨在成為插槽的完整權威參考;"
32-
"請參閱 :ref:`type-structs` 中的插槽部分文件來了解有關於插槽的詳細資訊。"
31+
"此章節說明型別的插槽如何與物件的生命週期相關聯。它並非旨在成為插槽的完整權威"
32+
"參考;請參閱 :ref:`type-structs` 中的插槽部分文件來了解有關於插槽的詳細資訊。"
3333

3434
#: ../../c-api/lifecycle.rst:15
3535
msgid "Life Events"
@@ -43,45 +43,45 @@ msgid ""
4343
"condition that must be true for *B* to occur after *A*."
4444
msgstr ""
4545

46-
#: ../../c-api/lifecycle.rst:55 ../../c-api/lifecycle.rst:62
46+
#: ../../c-api/lifecycle.rst:55
4747
msgid "Diagram showing events in an object's life. Explained in detail below."
4848
msgstr ""
4949

50-
#: ../../c-api/lifecycle.rst:70
50+
#: ../../c-api/lifecycle.rst:63
5151
msgid "Explanation:"
5252
msgstr "說明:"
5353

54-
#: ../../c-api/lifecycle.rst:72
54+
#: ../../c-api/lifecycle.rst:65
5555
msgid "When a new object is constructed by calling its type:"
5656
msgstr "當一個新物件透過其型別來建構時:"
5757

58-
#: ../../c-api/lifecycle.rst:74
58+
#: ../../c-api/lifecycle.rst:67
5959
msgid ":c:member:`~PyTypeObject.tp_new` is called to create a new object."
6060
msgstr ":c:member:`~PyTypeObject.tp_new` 會被呼叫來建立一個新物件。"
6161

62-
#: ../../c-api/lifecycle.rst:75
62+
#: ../../c-api/lifecycle.rst:68
6363
msgid ""
6464
":c:member:`~PyTypeObject.tp_alloc` is directly called by :c:member:"
6565
"`~PyTypeObject.tp_new` to allocate the memory for the new object."
6666
msgstr ""
6767

68-
#: ../../c-api/lifecycle.rst:78
68+
#: ../../c-api/lifecycle.rst:71
6969
msgid ""
7070
":c:member:`~PyTypeObject.tp_init` initializes the newly created object. :c:"
7171
"member:`!tp_init` can be called again to re-initialize an object, if "
7272
"desired. The :c:member:`!tp_init` call can also be skipped entirely, for "
7373
"example by Python code calling :py:meth:`~object.__new__`."
7474
msgstr ""
7575

76-
#: ../../c-api/lifecycle.rst:83
76+
#: ../../c-api/lifecycle.rst:76
7777
msgid "After :c:member:`!tp_init` completes, the object is ready to use."
7878
msgstr "在 :c:member:`!tp_init` 完成後,該物件即可使用。"
7979

80-
#: ../../c-api/lifecycle.rst:84
80+
#: ../../c-api/lifecycle.rst:77
8181
msgid "Some time after the last reference to an object is removed:"
8282
msgstr "在最後一個對物件的參照被移除一段時間後:"
8383

84-
#: ../../c-api/lifecycle.rst:86
84+
#: ../../c-api/lifecycle.rst:79
8585
msgid ""
8686
"If an object is not marked as *finalized*, it might be finalized by marking "
8787
"it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` "
@@ -90,29 +90,29 @@ msgid ""
9090
"that :c:member:`~PyTypeObject.tp_finalize` is always called."
9191
msgstr ""
9292

93-
#: ../../c-api/lifecycle.rst:92
93+
#: ../../c-api/lifecycle.rst:85
9494
msgid ""
9595
"If the object is marked as finalized, :c:member:`~PyTypeObject.tp_clear` "
9696
"might be called by the garbage collector to clear references held by the "
9797
"object. It is *not* called when the object's reference count reaches zero."
9898
msgstr ""
9999

100-
#: ../../c-api/lifecycle.rst:96
100+
#: ../../c-api/lifecycle.rst:89
101101
msgid ""
102102
":c:member:`~PyTypeObject.tp_dealloc` is called to destroy the object. To "
103103
"avoid code duplication, :c:member:`~PyTypeObject.tp_dealloc` typically calls "
104104
"into :c:member:`~PyTypeObject.tp_clear` to free up the object's references."
105105
msgstr ""
106106

107-
#: ../../c-api/lifecycle.rst:100
107+
#: ../../c-api/lifecycle.rst:93
108108
msgid ""
109109
"When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it "
110110
"directly calls :c:member:`~PyTypeObject.tp_free` (usually set to :c:func:"
111111
"`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as appropriate "
112112
"for the type) to deallocate the memory."
113113
msgstr ""
114114

115-
#: ../../c-api/lifecycle.rst:105
115+
#: ../../c-api/lifecycle.rst:98
116116
msgid ""
117117
"The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a "
118118
"reference to the object if desired. If it does, the object is "
@@ -127,7 +127,7 @@ msgid ""
127127
"both of these behaviors may change in the future."
128128
msgstr ""
129129

130-
#: ../../c-api/lifecycle.rst:118
130+
#: ../../c-api/lifecycle.rst:111
131131
msgid ""
132132
":c:member:`~PyTypeObject.tp_dealloc` can optionally call :c:member:"
133133
"`~PyTypeObject.tp_finalize` via :c:func:`PyObject_CallFinalizerFromDealloc` "
@@ -137,7 +137,7 @@ msgid ""
137137
"documentation for example code."
138138
msgstr ""
139139

140-
#: ../../c-api/lifecycle.rst:125
140+
#: ../../c-api/lifecycle.rst:118
141141
msgid ""
142142
"If the object is a member of a :term:`cyclic isolate` and either :c:member:"
143143
"`~PyTypeObject.tp_clear` fails to break the reference cycle or the cyclic "
@@ -147,20 +147,20 @@ msgid ""
147147
"\"leak\"). See :data:`gc.garbage`."
148148
msgstr ""
149149

150-
#: ../../c-api/lifecycle.rst:132
150+
#: ../../c-api/lifecycle.rst:125
151151
msgid ""
152152
"If the object is marked as supporting garbage collection (the :c:macro:"
153153
"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`), the "
154154
"following events are also possible:"
155155
msgstr ""
156156

157-
#: ../../c-api/lifecycle.rst:136
157+
#: ../../c-api/lifecycle.rst:129
158158
msgid ""
159159
"The garbage collector occasionally calls :c:member:`~PyTypeObject."
160160
"tp_traverse` to identify :term:`cyclic isolates <cyclic isolate>`."
161161
msgstr ""
162162

163-
#: ../../c-api/lifecycle.rst:139
163+
#: ../../c-api/lifecycle.rst:132
164164
msgid ""
165165
"When the garbage collector discovers a :term:`cyclic isolate`, it finalizes "
166166
"one of the objects in the group by marking it as *finalized* and calling "
@@ -169,7 +169,7 @@ msgid ""
169169
"been finalized."
170170
msgstr ""
171171

172-
#: ../../c-api/lifecycle.rst:144
172+
#: ../../c-api/lifecycle.rst:137
173173
msgid ""
174174
":c:member:`~PyTypeObject.tp_finalize` is permitted to resurrect the object "
175175
"by adding a reference from outside the :term:`cyclic isolate`. The new "
@@ -178,7 +178,7 @@ msgid ""
178178
"longer isolated)."
179179
msgstr ""
180180

181-
#: ../../c-api/lifecycle.rst:149
181+
#: ../../c-api/lifecycle.rst:142
182182
msgid ""
183183
"When the garbage collector discovers a :term:`cyclic isolate` and all of the "
184184
"objects in the group have already been marked as *finalized*, the garbage "
@@ -188,11 +188,11 @@ msgid ""
188188
"all of the objects have been cleared."
189189
msgstr ""
190190

191-
#: ../../c-api/lifecycle.rst:158
191+
#: ../../c-api/lifecycle.rst:151
192192
msgid "Cyclic Isolate Destruction"
193193
msgstr ""
194194

195-
#: ../../c-api/lifecycle.rst:160
195+
#: ../../c-api/lifecycle.rst:153
196196
msgid ""
197197
"Listed below are the stages of life of a hypothetical :term:`cyclic isolate` "
198198
"that continues to exist after each member object is finalized or cleared. "
@@ -203,14 +203,14 @@ msgid ""
203203
"(see :c:member:`~PyTypeObject.tp_finalize`)."
204204
msgstr ""
205205

206-
#: ../../c-api/lifecycle.rst:168
206+
#: ../../c-api/lifecycle.rst:161
207207
msgid ""
208208
"**Reachable** (not yet a cyclic isolate): All objects are in their normal, "
209209
"reachable state. A reference cycle could exist, but an external reference "
210210
"means the objects are not yet isolated."
211211
msgstr ""
212212

213-
#: ../../c-api/lifecycle.rst:171
213+
#: ../../c-api/lifecycle.rst:164
214214
msgid ""
215215
"**Unreachable but consistent:** The final reference from outside the cyclic "
216216
"group of objects has been removed, causing the objects to become isolated "
@@ -220,7 +220,7 @@ msgid ""
220220
"because the next run might not scan every object)."
221221
msgstr ""
222222

223-
#: ../../c-api/lifecycle.rst:177
223+
#: ../../c-api/lifecycle.rst:170
224224
msgid ""
225225
"**Mix of finalized and not finalized:** Objects in a cyclic isolate are "
226226
"finalized one at a time, which means that there is a period of time when the "
@@ -231,21 +231,21 @@ msgid ""
231231
"an arbitrary subset of its referents."
232232
msgstr ""
233233

234-
#: ../../c-api/lifecycle.rst:184
234+
#: ../../c-api/lifecycle.rst:177
235235
msgid ""
236236
"**All finalized:** All objects in a cyclic isolate are finalized before any "
237237
"of them are cleared."
238238
msgstr ""
239239

240-
#: ../../c-api/lifecycle.rst:186
240+
#: ../../c-api/lifecycle.rst:179
241241
msgid ""
242242
"**Mix of finalized and cleared:** The objects can be cleared serially or "
243243
"concurrently (but with the :term:`GIL` held); either way, some will finish "
244244
"before others. A finalized object must be able to tolerate the clearing of "
245245
"a subset of its referents. :pep:`442` calls this stage \"cyclic trash\"."
246246
msgstr ""
247247

248-
#: ../../c-api/lifecycle.rst:190
248+
#: ../../c-api/lifecycle.rst:183
249249
msgid ""
250250
"**Leaked:** If a cyclic isolate still exists after all objects in the group "
251251
"have been finalized and cleared, then the objects remain indefinitely "
@@ -255,7 +255,7 @@ msgid ""
255255
"required."
256256
msgstr ""
257257

258-
#: ../../c-api/lifecycle.rst:197
258+
#: ../../c-api/lifecycle.rst:190
259259
msgid ""
260260
"If :c:member:`~PyTypeObject.tp_clear` did not exist, then Python would have "
261261
"no way to safely break a reference cycle. Simply destroying an object in a "
@@ -267,7 +267,7 @@ msgid ""
267267
"`~PyTypeObject.tp_dealloc` is called to complete the destruction."
268268
msgstr ""
269269

270-
#: ../../c-api/lifecycle.rst:206
270+
#: ../../c-api/lifecycle.rst:199
271271
msgid ""
272272
"Unlike clearing, finalization is not a phase of destruction. A finalized "
273273
"object must still behave properly by continuing to fulfill its design "
@@ -279,7 +279,7 @@ msgid ""
279279
"`~PyTypeObject.tp_dealloc`."
280280
msgstr ""
281281

282-
#: ../../c-api/lifecycle.rst:214
282+
#: ../../c-api/lifecycle.rst:207
283283
msgid ""
284284
"The finalization step is not necessary to safely reclaim the objects in a "
285285
"cyclic isolate, but its existence makes it easier to design types that "
@@ -291,29 +291,29 @@ msgid ""
291291
"only non-cleared (but potentially finalized) objects."
292292
msgstr ""
293293

294-
#: ../../c-api/lifecycle.rst:223
294+
#: ../../c-api/lifecycle.rst:216
295295
msgid "To summarize the possible interactions:"
296296
msgstr ""
297297

298-
#: ../../c-api/lifecycle.rst:225
298+
#: ../../c-api/lifecycle.rst:218
299299
msgid ""
300300
"A non-finalized object might have references to or from non-finalized and "
301301
"finalized objects, but not to or from cleared objects."
302302
msgstr ""
303303

304-
#: ../../c-api/lifecycle.rst:227
304+
#: ../../c-api/lifecycle.rst:220
305305
msgid ""
306306
"A finalized object might have references to or from non-finalized, "
307307
"finalized, and cleared objects."
308308
msgstr ""
309309

310-
#: ../../c-api/lifecycle.rst:229
310+
#: ../../c-api/lifecycle.rst:222
311311
msgid ""
312312
"A cleared object might have references to or from finalized and cleared "
313313
"objects, but not to or from non-finalized objects."
314314
msgstr ""
315315

316-
#: ../../c-api/lifecycle.rst:232
316+
#: ../../c-api/lifecycle.rst:225
317317
msgid ""
318318
"Without any reference cycles, an object can be simply destroyed once its "
319319
"last reference is deleted; the finalization and clearing steps are not "
@@ -327,15 +327,15 @@ msgid ""
327327
"change in a future version."
328328
msgstr ""
329329

330-
#: ../../c-api/lifecycle.rst:244
330+
#: ../../c-api/lifecycle.rst:237
331331
msgid "Functions"
332332
msgstr "函式"
333333

334-
#: ../../c-api/lifecycle.rst:246
334+
#: ../../c-api/lifecycle.rst:239
335335
msgid "To allocate and free memory, see :ref:`allocating-objects`."
336336
msgstr "要分配和釋放記憶體,請參見 :ref:`allocating-objects`。"
337337

338-
#: ../../c-api/lifecycle.rst:251
338+
#: ../../c-api/lifecycle.rst:244
339339
msgid ""
340340
"Finalizes the object as described in :c:member:`~PyTypeObject.tp_finalize`. "
341341
"Call this function (or :c:func:`PyObject_CallFinalizerFromDealloc`) instead "
@@ -346,7 +346,7 @@ msgid ""
346346
"change in the future."
347347
msgstr ""
348348

349-
#: ../../c-api/lifecycle.rst:264
349+
#: ../../c-api/lifecycle.rst:257
350350
msgid ""
351351
"Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the "
352352
"beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). "
@@ -356,6 +356,6 @@ msgid ""
356356
"continue normally."
357357
msgstr ""
358358

359-
#: ../../c-api/lifecycle.rst:275
359+
#: ../../c-api/lifecycle.rst:268
360360
msgid ":c:member:`~PyTypeObject.tp_dealloc` for example code."
361361
msgstr ""

0 commit comments

Comments
 (0)