Skip to content

Commit 21be873

Browse files
sync with cpython 378b24b5
1 parent 7650db5 commit 21be873

File tree

2 files changed

+411
-397
lines changed

2 files changed

+411
-397
lines changed

c-api/gcsupport.po

Lines changed: 79 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Python 3.14\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2025-09-08 15:25+0800\n"
9+
"POT-Creation-Date: 2025-12-09 00:14+0000\n"
1010
"PO-Revision-Date: 2018-05-23 14:31+0000\n"
1111
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1212
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -75,8 +75,8 @@ msgstr ""
7575

7676
#: ../../c-api/gcsupport.rst:37
7777
msgid ""
78-
"Before fields which refer to other containers are "
79-
"invalidated, :c:func:`PyObject_GC_UnTrack` must be called."
78+
"Before fields which refer to other containers are invalidated, :c:func:"
79+
"`PyObject_GC_UnTrack` must be called."
8080
msgstr ""
8181

8282
#: ../../c-api/gcsupport.rst:40
@@ -86,39 +86,39 @@ msgstr ""
8686

8787
#: ../../c-api/gcsupport.rst:43
8888
msgid ""
89-
"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least "
90-
"a :c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from "
91-
"its subclass or subclasses."
89+
"If a type adds the Py_TPFLAGS_HAVE_GC, then it *must* implement at least a :"
90+
"c:member:`~PyTypeObject.tp_traverse` handler or explicitly use one from its "
91+
"subclass or subclasses."
9292
msgstr ""
9393

9494
#: ../../c-api/gcsupport.rst:47
9595
msgid ""
9696
"When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call "
9797
"it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the "
98-
"interpreter will automatically populate "
99-
"the :c:member:`~PyTypeObject.tp_flags`, :c:member:`~PyTypeObject.tp_traverse` "
100-
"and :c:member:`~PyTypeObject.tp_clear` fields if the type inherits from a "
101-
"class that implements the garbage collector protocol and the child class "
102-
"does *not* include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag."
98+
"interpreter will automatically populate the :c:member:`~PyTypeObject."
99+
"tp_flags`, :c:member:`~PyTypeObject.tp_traverse` and :c:member:"
100+
"`~PyTypeObject.tp_clear` fields if the type inherits from a class that "
101+
"implements the garbage collector protocol and the child class does *not* "
102+
"include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag."
103103
msgstr ""
104104

105105
#: ../../c-api/gcsupport.rst:57
106106
msgid ""
107-
"Analogous to :c:macro:`PyObject_New` but for container objects with "
108-
"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set."
107+
"Analogous to :c:macro:`PyObject_New` but for container objects with the :c:"
108+
"macro:`Py_TPFLAGS_HAVE_GC` flag set."
109109
msgstr ""
110110

111111
#: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84
112112
msgid ""
113-
"Do not call this directly to allocate memory for an object; call the "
114-
"type's :c:member:`~PyTypeObject.tp_alloc` slot instead."
113+
"Do not call this directly to allocate memory for an object; call the type's :"
114+
"c:member:`~PyTypeObject.tp_alloc` slot instead."
115115
msgstr ""
116116

117117
#: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87
118118
msgid ""
119-
"When populating a type's :c:member:`~PyTypeObject.tp_alloc` "
120-
"slot, :c:func:`PyType_GenericAlloc` is preferred over a custom function that "
121-
"simply calls this macro."
119+
"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:"
120+
"`PyType_GenericAlloc` is preferred over a custom function that simply calls "
121+
"this macro."
122122
msgstr ""
123123

124124
#: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91
@@ -146,8 +146,8 @@ msgstr ":c:member:`~PyTypeObject.tp_alloc`"
146146

147147
#: ../../c-api/gcsupport.rst:81
148148
msgid ""
149-
"Analogous to :c:macro:`PyObject_NewVar` but for container objects with "
150-
"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set."
149+
"Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :"
150+
"c:macro:`Py_TPFLAGS_HAVE_GC` flag set."
151151
msgstr ""
152152

153153
#: ../../c-api/gcsupport.rst:98
@@ -170,17 +170,17 @@ msgstr ""
170170

171171
#: ../../c-api/gcsupport.rst:114
172172
msgid ""
173-
"Memory allocated by this function must be freed "
174-
"with :c:func:`PyObject_GC_Del` (usually called via the "
175-
"object's :c:member:`~PyTypeObject.tp_free` slot)."
173+
"Memory allocated by this function must be freed with :c:func:"
174+
"`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject."
175+
"tp_free` slot)."
176176
msgstr ""
177177

178178
#: ../../c-api/gcsupport.rst:119
179179
msgid ""
180180
"The function is marked as unstable because the final mechanism for reserving "
181181
"extra data after an instance is not yet decided. For allocating a variable "
182-
"number of fields, prefer using :c:type:`PyVarObject` "
183-
"and :c:member:`~PyTypeObject.tp_itemsize` instead."
182+
"number of fields, prefer using :c:type:`PyVarObject` and :c:member:"
183+
"`~PyTypeObject.tp_itemsize` instead."
184184
msgstr ""
185185

186186
#: ../../c-api/gcsupport.rst:130
@@ -239,21 +239,21 @@ msgstr ""
239239

240240
#: ../../c-api/gcsupport.rst:178
241241
msgid ""
242-
"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` "
243-
"or :c:macro:`PyObject_GC_NewVar`."
242+
"Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :"
243+
"c:macro:`PyObject_GC_NewVar`."
244244
msgstr ""
245245

246246
#: ../../c-api/gcsupport.rst:181
247247
msgid ""
248-
"Do not call this directly to free an object's memory; call the "
249-
"type's :c:member:`~PyTypeObject.tp_free` slot instead."
248+
"Do not call this directly to free an object's memory; call the type's :c:"
249+
"member:`~PyTypeObject.tp_free` slot instead."
250250
msgstr ""
251251

252252
#: ../../c-api/gcsupport.rst:184
253253
msgid ""
254-
"Do not use this for memory allocated "
255-
"by :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, or related "
256-
"allocation functions; use :c:func:`PyObject_Free` instead."
254+
"Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:"
255+
"`PyObject_NewVar`, or related allocation functions; use :c:func:"
256+
"`PyObject_Free` instead."
257257
msgstr ""
258258

259259
#: ../../c-api/gcsupport.rst:190
@@ -276,10 +276,10 @@ msgstr ":c:member:`~PyTypeObject.tp_free`"
276276
msgid ""
277277
"Remove the object *op* from the set of container objects tracked by the "
278278
"collector. Note that :c:func:`PyObject_GC_Track` can be called again on "
279-
"this object to add it back to the set of tracked objects. The deallocator "
280-
"(:c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the "
281-
"object before any of the fields used by "
282-
"the :c:member:`~PyTypeObject.tp_traverse` handler become invalid."
279+
"this object to add it back to the set of tracked objects. The deallocator (:"
280+
"c:member:`~PyTypeObject.tp_dealloc` handler) should call this for the object "
281+
"before any of the fields used by the :c:member:`~PyTypeObject.tp_traverse` "
282+
"handler become invalid."
283283
msgstr ""
284284

285285
#: ../../c-api/gcsupport.rst:208
@@ -296,12 +296,12 @@ msgstr ""
296296

297297
#: ../../c-api/gcsupport.rst:216
298298
msgid ""
299-
"Type of the visitor function passed to "
300-
"the :c:member:`~PyTypeObject.tp_traverse` handler. The function should be "
301-
"called with an object to traverse as *object* and the third parameter to "
302-
"the :c:member:`~PyTypeObject.tp_traverse` handler as *arg*. The Python core "
303-
"uses several visitor functions to implement cyclic garbage detection; it's "
304-
"not expected that users will need to write their own visitor functions."
299+
"Type of the visitor function passed to the :c:member:`~PyTypeObject."
300+
"tp_traverse` handler. The function should be called with an object to "
301+
"traverse as *object* and the third parameter to the :c:member:`~PyTypeObject."
302+
"tp_traverse` handler as *arg*. The Python core uses several visitor "
303+
"functions to implement cyclic garbage detection; it's not expected that "
304+
"users will need to write their own visitor functions."
305305
msgstr ""
306306

307307
#: ../../c-api/gcsupport.rst:223
@@ -322,21 +322,28 @@ msgstr ""
322322

323323
#: ../../c-api/gcsupport.rst:235
324324
msgid ""
325-
"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, "
326-
"a :c:func:`Py_VISIT` macro is provided. In order to use this macro, "
327-
"the :c:member:`~PyTypeObject.tp_traverse` implementation must name its "
328-
"arguments exactly *visit* and *arg*:"
325+
"The traversal function must not have any side effects. Implementations may "
326+
"not modify the reference counts of any Python objects nor create or destroy "
327+
"any Python objects."
328+
msgstr ""
329+
330+
#: ../../c-api/gcsupport.rst:239
331+
msgid ""
332+
"To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:"
333+
"func:`Py_VISIT` macro is provided. In order to use this macro, the :c:"
334+
"member:`~PyTypeObject.tp_traverse` implementation must name its arguments "
335+
"exactly *visit* and *arg*:"
329336
msgstr ""
330337

331-
#: ../../c-api/gcsupport.rst:242
338+
#: ../../c-api/gcsupport.rst:246
332339
msgid ""
333340
"If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, "
334341
"with arguments *o* and *arg*. If *visit* returns a non-zero value, then "
335342
"return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers "
336343
"look like::"
337344
msgstr ""
338345

339-
#: ../../c-api/gcsupport.rst:247
346+
#: ../../c-api/gcsupport.rst:251
340347
msgid ""
341348
"static int\n"
342349
"my_traverse(Noddy *self, visitproc visit, void *arg)\n"
@@ -354,13 +361,13 @@ msgstr ""
354361
" return 0;\n"
355362
"}"
356363

357-
#: ../../c-api/gcsupport.rst:255
364+
#: ../../c-api/gcsupport.rst:259
358365
msgid ""
359-
"The :c:member:`~PyTypeObject.tp_clear` handler must be of "
360-
"the :c:type:`inquiry` type, or ``NULL`` if the object is immutable."
366+
"The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:"
367+
"`inquiry` type, or ``NULL`` if the object is immutable."
361368
msgstr ""
362369

363-
#: ../../c-api/gcsupport.rst:261
370+
#: ../../c-api/gcsupport.rst:265
364371
msgid ""
365372
"Drop references that may have created reference cycles. Immutable objects "
366373
"do not have to define this method since they can never directly create "
@@ -370,82 +377,82 @@ msgid ""
370377
"in a reference cycle."
371378
msgstr ""
372379

373-
#: ../../c-api/gcsupport.rst:270
380+
#: ../../c-api/gcsupport.rst:274
374381
msgid "Controlling the Garbage Collector State"
375382
msgstr ""
376383

377-
#: ../../c-api/gcsupport.rst:272
384+
#: ../../c-api/gcsupport.rst:276
378385
msgid ""
379386
"The C-API provides the following functions for controlling garbage "
380387
"collection runs."
381388
msgstr ""
382389

383-
#: ../../c-api/gcsupport.rst:277
390+
#: ../../c-api/gcsupport.rst:281
384391
msgid ""
385392
"Perform a full garbage collection, if the garbage collector is enabled. "
386393
"(Note that :func:`gc.collect` runs it unconditionally.)"
387394
msgstr ""
388395

389-
#: ../../c-api/gcsupport.rst:280
396+
#: ../../c-api/gcsupport.rst:284
390397
msgid ""
391398
"Returns the number of collected + unreachable objects which cannot be "
392399
"collected. If the garbage collector is disabled or already collecting, "
393-
"returns ``0`` immediately. Errors during garbage collection are passed "
394-
"to :data:`sys.unraisablehook`. This function does not raise exceptions."
400+
"returns ``0`` immediately. Errors during garbage collection are passed to :"
401+
"data:`sys.unraisablehook`. This function does not raise exceptions."
395402
msgstr ""
396403

397-
#: ../../c-api/gcsupport.rst:290
404+
#: ../../c-api/gcsupport.rst:294
398405
msgid ""
399406
"Enable the garbage collector: similar to :func:`gc.enable`. Returns the "
400407
"previous state, 0 for disabled and 1 for enabled."
401408
msgstr ""
402409

403-
#: ../../c-api/gcsupport.rst:298
410+
#: ../../c-api/gcsupport.rst:302
404411
msgid ""
405412
"Disable the garbage collector: similar to :func:`gc.disable`. Returns the "
406413
"previous state, 0 for disabled and 1 for enabled."
407414
msgstr ""
408415

409-
#: ../../c-api/gcsupport.rst:306
416+
#: ../../c-api/gcsupport.rst:310
410417
msgid ""
411418
"Query the state of the garbage collector: similar to :func:`gc.isenabled`. "
412419
"Returns the current state, 0 for disabled and 1 for enabled."
413420
msgstr ""
414421

415-
#: ../../c-api/gcsupport.rst:313
422+
#: ../../c-api/gcsupport.rst:317
416423
msgid "Querying Garbage Collector State"
417424
msgstr ""
418425

419-
#: ../../c-api/gcsupport.rst:315
426+
#: ../../c-api/gcsupport.rst:319
420427
msgid ""
421428
"The C-API provides the following interface for querying information about "
422429
"the garbage collector."
423430
msgstr ""
424431

425-
#: ../../c-api/gcsupport.rst:320
432+
#: ../../c-api/gcsupport.rst:324
426433
msgid ""
427434
"Run supplied *callback* on all live GC-capable objects. *arg* is passed "
428435
"through to all invocations of *callback*."
429436
msgstr ""
430437

431-
#: ../../c-api/gcsupport.rst:324
438+
#: ../../c-api/gcsupport.rst:328
432439
msgid ""
433440
"If new objects are (de)allocated by the callback it is undefined if they "
434441
"will be visited."
435442
msgstr ""
436443

437-
#: ../../c-api/gcsupport.rst:327
444+
#: ../../c-api/gcsupport.rst:331
438445
msgid ""
439446
"Garbage collection is disabled during operation. Explicitly running a "
440447
"collection in the callback may lead to undefined behaviour e.g. visiting the "
441448
"same objects multiple times or not at all."
442449
msgstr ""
443450

444-
#: ../../c-api/gcsupport.rst:335
451+
#: ../../c-api/gcsupport.rst:339
445452
msgid ""
446-
"Type of the visitor function to be passed "
447-
"to :c:func:`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* "
448-
"passed to ``PyUnstable_GC_VisitObjects``. Return ``1`` to continue "
449-
"iteration, return ``0`` to stop iteration. Other return values are reserved "
450-
"for now so behavior on returning anything else is undefined."
453+
"Type of the visitor function to be passed to :c:func:"
454+
"`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to "
455+
"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return "
456+
"``0`` to stop iteration. Other return values are reserved for now so "
457+
"behavior on returning anything else is undefined."
451458
msgstr ""

0 commit comments

Comments
 (0)