Skip to content

Commit 20c5346

Browse files
sync with cpython f7567b44
1 parent 3f74187 commit 20c5346

File tree

2 files changed

+154
-145
lines changed

2 files changed

+154
-145
lines changed

c-api/lifecycle.po

Lines changed: 44 additions & 50 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-09-08 15:25+0800\n"
10+
"POT-Creation-Date: 2026-01-21 00:15+0000\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -24,8 +24,8 @@ msgstr "物件生命週期"
2424
msgid ""
2525
"This section explains how a type's slots relate to each other throughout the "
2626
"life of an object. It is not intended to be a complete canonical reference "
27-
"for the slots; instead, refer to the slot-specific documentation "
28-
"in :ref:`type-structs` for details about a particular slot."
27+
"for the slots; instead, refer to the slot-specific documentation in :ref:"
28+
"`type-structs` for details about a particular slot."
2929
msgstr ""
3030

3131
#: ../../c-api/lifecycle.rst:15
@@ -58,16 +58,15 @@ msgstr ":c:member:`~PyTypeObject.tp_new` 會被呼叫來建立一個新物件。
5858

5959
#: ../../c-api/lifecycle.rst:75
6060
msgid ""
61-
":c:member:`~PyTypeObject.tp_alloc` is directly called "
62-
"by :c:member:`~PyTypeObject.tp_new` to allocate the memory for the new "
63-
"object."
61+
":c:member:`~PyTypeObject.tp_alloc` is directly called by :c:member:"
62+
"`~PyTypeObject.tp_new` to allocate the memory for the new object."
6463
msgstr ""
6564

6665
#: ../../c-api/lifecycle.rst:78
6766
msgid ""
68-
":c:member:`~PyTypeObject.tp_init` initializes the newly created "
69-
"object. :c:member:`!tp_init` can be called again to re-initialize an object, "
70-
"if desired. The :c:member:`!tp_init` call can also be skipped entirely, for "
67+
":c:member:`~PyTypeObject.tp_init` initializes the newly created object. :c:"
68+
"member:`!tp_init` can be called again to re-initialize an object, if "
69+
"desired. The :c:member:`!tp_init` call can also be skipped entirely, for "
7170
"example by Python code calling :py:meth:`~object.__new__`."
7271
msgstr ""
7372

@@ -105,19 +104,18 @@ msgstr ""
105104
#: ../../c-api/lifecycle.rst:100
106105
msgid ""
107106
"When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it "
108-
"directly calls :c:member:`~PyTypeObject.tp_free` (usually set "
109-
"to :c:func:`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as "
110-
"appropriate for the type) to deallocate the memory."
107+
"directly calls :c:member:`~PyTypeObject.tp_free` (usually set to :c:func:"
108+
"`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as appropriate "
109+
"for the type) to deallocate the memory."
111110
msgstr ""
112111

113112
#: ../../c-api/lifecycle.rst:105
114113
msgid ""
115114
"The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a "
116115
"reference to the object if desired. If it does, the object is "
117116
"*resurrected*, preventing its pending destruction. (Only :c:member:`!"
118-
"tp_finalize` is allowed to resurrect an "
119-
"object; :c:member:`~PyTypeObject.tp_clear` "
120-
"and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling "
117+
"tp_finalize` is allowed to resurrect an object; :c:member:`~PyTypeObject."
118+
"tp_clear` and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling "
121119
"into :c:member:`!tp_finalize`.) Resurrecting an object may or may not cause "
122120
"the object's *finalized* mark to be removed. Currently, Python does not "
123121
"remove the *finalized* mark from a resurrected object if it supports garbage "
@@ -128,38 +126,35 @@ msgstr ""
128126

129127
#: ../../c-api/lifecycle.rst:118
130128
msgid ""
131-
":c:member:`~PyTypeObject.tp_dealloc` can optionally "
132-
"call :c:member:`~PyTypeObject.tp_finalize` "
133-
"via :c:func:`PyObject_CallFinalizerFromDealloc` if it wishes to reuse that "
134-
"code to help with object destruction. This is recommended because it "
135-
"guarantees that :c:member:`!tp_finalize` is always called before "
136-
"destruction. See the :c:member:`~PyTypeObject.tp_dealloc` documentation for "
137-
"example code."
129+
":c:member:`~PyTypeObject.tp_dealloc` can optionally call :c:member:"
130+
"`~PyTypeObject.tp_finalize` via :c:func:`PyObject_CallFinalizerFromDealloc` "
131+
"if it wishes to reuse that code to help with object destruction. This is "
132+
"recommended because it guarantees that :c:member:`!tp_finalize` is always "
133+
"called before destruction. See the :c:member:`~PyTypeObject.tp_dealloc` "
134+
"documentation for example code."
138135
msgstr ""
139136

140137
#: ../../c-api/lifecycle.rst:125
141138
msgid ""
142-
"If the object is a member of a :term:`cyclic isolate` and "
143-
"either :c:member:`~PyTypeObject.tp_clear` fails to break the reference cycle "
144-
"or the cyclic isolate is not detected (perhaps :func:`gc.disable` was "
145-
"called, or the :c:macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in "
146-
"one of the involved types), the objects remain indefinitely uncollectable "
147-
"(they \"leak\"). See :data:`gc.garbage`."
139+
"If the object is a member of a :term:`cyclic isolate` and either :c:member:"
140+
"`~PyTypeObject.tp_clear` fails to break the reference cycle or the cyclic "
141+
"isolate is not detected (perhaps :func:`gc.disable` was called, or the :c:"
142+
"macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in one of the "
143+
"involved types), the objects remain indefinitely uncollectable (they "
144+
"\"leak\"). See :data:`gc.garbage`."
148145
msgstr ""
149146

150147
#: ../../c-api/lifecycle.rst:132
151148
msgid ""
152-
"If the object is marked as supporting garbage collection "
153-
"(the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set "
154-
"in :c:member:`~PyTypeObject.tp_flags`), the following events are also "
155-
"possible:"
149+
"If the object is marked as supporting garbage collection (the :c:macro:"
150+
"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`), the "
151+
"following events are also possible:"
156152
msgstr ""
157153

158154
#: ../../c-api/lifecycle.rst:136
159155
msgid ""
160-
"The garbage collector occasionally "
161-
"calls :c:member:`~PyTypeObject.tp_traverse` to identify :term:`cyclic "
162-
"isolates <cyclic isolate>`."
156+
"The garbage collector occasionally calls :c:member:`~PyTypeObject."
157+
"tp_traverse` to identify :term:`cyclic isolates <cyclic isolate>`."
163158
msgstr ""
164159

165160
#: ../../c-api/lifecycle.rst:139
@@ -265,9 +260,8 @@ msgid ""
265260
"behavior when an object referencing the destroyed object is itself "
266261
"destroyed. The clearing step makes object destruction a two-phase process: "
267262
"first :c:member:`~PyTypeObject.tp_clear` is called to partially destroy the "
268-
"objects enough to detangle them from each other, "
269-
"then :c:member:`~PyTypeObject.tp_dealloc` is called to complete the "
270-
"destruction."
263+
"objects enough to detangle them from each other, then :c:member:"
264+
"`~PyTypeObject.tp_dealloc` is called to complete the destruction."
271265
msgstr ""
272266

273267
#: ../../c-api/lifecycle.rst:206
@@ -277,9 +271,9 @@ msgid ""
277271
"contracts. An object's finalizer is allowed to execute arbitrary Python "
278272
"code, and is even allowed to prevent the impending destruction by adding a "
279273
"reference. The finalizer is only related to destruction by call order---if "
280-
"it runs, it runs before destruction, which starts "
281-
"with :c:member:`~PyTypeObject.tp_clear` (if called) and concludes "
282-
"with :c:member:`~PyTypeObject.tp_dealloc`."
274+
"it runs, it runs before destruction, which starts with :c:member:"
275+
"`~PyTypeObject.tp_clear` (if called) and concludes with :c:member:"
276+
"`~PyTypeObject.tp_dealloc`."
283277
msgstr ""
284278

285279
#: ../../c-api/lifecycle.rst:214
@@ -321,13 +315,13 @@ msgid ""
321315
"Without any reference cycles, an object can be simply destroyed once its "
322316
"last reference is deleted; the finalization and clearing steps are not "
323317
"necessary to safely reclaim unused objects. However, it can be useful to "
324-
"automatically call :c:member:`~PyTypeObject.tp_finalize` "
325-
"and :c:member:`~PyTypeObject.tp_clear` before destruction anyway because "
326-
"type design is simplified when all objects always experience the same series "
327-
"of events regardless of whether they participated in a cyclic isolate. "
328-
"Python currently only calls :c:member:`~PyTypeObject.tp_finalize` "
329-
"and :c:member:`~PyTypeObject.tp_clear` as needed to destroy a cyclic "
330-
"isolate; this may change in a future version."
318+
"automatically call :c:member:`~PyTypeObject.tp_finalize` and :c:member:"
319+
"`~PyTypeObject.tp_clear` before destruction anyway because type design is "
320+
"simplified when all objects always experience the same series of events "
321+
"regardless of whether they participated in a cyclic isolate. Python "
322+
"currently only calls :c:member:`~PyTypeObject.tp_finalize` and :c:member:"
323+
"`~PyTypeObject.tp_clear` as needed to destroy a cyclic isolate; this may "
324+
"change in a future version."
331325
msgstr ""
332326

333327
#: ../../c-api/lifecycle.rst:244
@@ -349,7 +343,7 @@ msgid ""
349343
"change in the future."
350344
msgstr ""
351345

352-
#: ../../c-api/lifecycle.rst:262
346+
#: ../../c-api/lifecycle.rst:264
353347
msgid ""
354348
"Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the "
355349
"beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). "
@@ -359,6 +353,6 @@ msgid ""
359353
"continue normally."
360354
msgstr ""
361355

362-
#: ../../c-api/lifecycle.rst:271
356+
#: ../../c-api/lifecycle.rst:275
363357
msgid ":c:member:`~PyTypeObject.tp_dealloc` for example code."
364358
msgstr ""

0 commit comments

Comments
 (0)