Skip to content

Commit 44f51e8

Browse files
sync with cpython a8c3af08
1 parent 721b9f5 commit 44f51e8

File tree

4 files changed

+319
-302
lines changed

4 files changed

+319
-302
lines changed

c-api/type.po

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ msgid ""
66
msgstr ""
77
"Project-Id-Version: Python 3.13\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"POT-Creation-Date: 2025-04-03 00:14+0000\n"
9+
"POT-Creation-Date: 2025-06-20 00:15+0000\n"
1010
"PO-Revision-Date: 2015-12-09 17:51+0000\n"
1111
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
1212
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -301,40 +301,47 @@ msgid ""
301301
"type:`PyCMethod` calling convention."
302302
msgstr ""
303303

304-
#: ../../c-api/type.rst:274
304+
#: ../../c-api/type.rst:270
305+
msgid ""
306+
"The returned reference is :term:`borrowed <borrowed reference>` from *type*, "
307+
"and will be valid as long as you hold a reference to *type*. Do not release "
308+
"it with :c:func:`Py_DECREF` or similar."
309+
msgstr ""
310+
311+
#: ../../c-api/type.rst:278
305312
msgid "Attempt to assign a version tag to the given type."
306313
msgstr ""
307314

308-
#: ../../c-api/type.rst:276
315+
#: ../../c-api/type.rst:280
309316
msgid ""
310317
"Returns 1 if the type already had a valid version tag or a new one was "
311318
"assigned, or 0 if a new tag could not be assigned."
312319
msgstr ""
313320

314-
#: ../../c-api/type.rst:283
321+
#: ../../c-api/type.rst:287
315322
msgid "Creating Heap-Allocated Types"
316323
msgstr ""
317324

318-
#: ../../c-api/type.rst:285
325+
#: ../../c-api/type.rst:289
319326
msgid ""
320327
"The following functions and structs are used to create :ref:`heap types "
321328
"<heap-types>`."
322329
msgstr ""
323330

324-
#: ../../c-api/type.rst:290
331+
#: ../../c-api/type.rst:294
325332
msgid ""
326333
"Create and return a :ref:`heap type <heap-types>` from the *spec* (see :c:"
327334
"macro:`Py_TPFLAGS_HEAPTYPE`)."
328335
msgstr ""
329336

330-
#: ../../c-api/type.rst:293
337+
#: ../../c-api/type.rst:297
331338
msgid ""
332339
"The metaclass *metaclass* is used to construct the resulting type object. "
333340
"When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or "
334341
"*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)."
335342
msgstr ""
336343

337-
#: ../../c-api/type.rst:297
344+
#: ../../c-api/type.rst:301
338345
msgid ""
339346
"Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not "
340347
"supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, "
@@ -343,7 +350,7 @@ msgid ""
343350
"deprecated and in Python 3.14+ such metaclasses will not be supported.)"
344351
msgstr ""
345352

346-
#: ../../c-api/type.rst:304
353+
#: ../../c-api/type.rst:308
347354
msgid ""
348355
"The *bases* argument can be used to specify base classes; it can either be "
349356
"only one class or a tuple of classes. If *bases* is ``NULL``, the "
@@ -352,7 +359,7 @@ msgid ""
352359
"derives from :class:`object`."
353360
msgstr ""
354361

355-
#: ../../c-api/type.rst:310
362+
#: ../../c-api/type.rst:314
356363
msgid ""
357364
"The *module* argument can be used to record the module in which the new "
358365
"class is defined. It must be a module object or ``NULL``. If not ``NULL``, "
@@ -361,11 +368,11 @@ msgid ""
361368
"subclasses; it must be specified for each class individually."
362369
msgstr ""
363370

364-
#: ../../c-api/type.rst:317
371+
#: ../../c-api/type.rst:321
365372
msgid "This function calls :c:func:`PyType_Ready` on the new type."
366373
msgstr ""
367374

368-
#: ../../c-api/type.rst:319
375+
#: ../../c-api/type.rst:323
369376
msgid ""
370377
"Note that this function does *not* fully match the behavior of calling :py:"
371378
"class:`type() <type>` or using the :keyword:`class` statement. With user-"
@@ -374,84 +381,84 @@ msgid ""
374381
"Specifically:"
375382
msgstr ""
376383

377-
#: ../../c-api/type.rst:326
384+
#: ../../c-api/type.rst:330
378385
msgid ""
379386
":py:meth:`~object.__new__` is not called on the new class (and it must be "
380387
"set to ``type.__new__``)."
381388
msgstr ""
382389

383-
#: ../../c-api/type.rst:328
390+
#: ../../c-api/type.rst:332
384391
msgid ":py:meth:`~object.__init__` is not called on the new class."
385392
msgstr ""
386393

387-
#: ../../c-api/type.rst:329
394+
#: ../../c-api/type.rst:333
388395
msgid ":py:meth:`~object.__init_subclass__` is not called on any bases."
389396
msgstr ""
390397

391-
#: ../../c-api/type.rst:330
398+
#: ../../c-api/type.rst:334
392399
msgid ":py:meth:`~object.__set_name__` is not called on new descriptors."
393400
msgstr ""
394401

395-
#: ../../c-api/type.rst:336
402+
#: ../../c-api/type.rst:340
396403
msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``."
397404
msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。"
398405

399-
#: ../../c-api/type.rst:342
406+
#: ../../c-api/type.rst:346
400407
msgid ""
401408
"The function now accepts a single class as the *bases* argument and ``NULL`` "
402409
"as the ``tp_doc`` slot."
403410
msgstr ""
404411

405-
#: ../../c-api/type.rst:347 ../../c-api/type.rst:364
412+
#: ../../c-api/type.rst:351 ../../c-api/type.rst:368
406413
msgid ""
407414
"The function now finds and uses a metaclass corresponding to the provided "
408415
"base classes. Previously, only :class:`type` instances were returned."
409416
msgstr ""
410417

411-
#: ../../c-api/type.rst:350 ../../c-api/type.rst:367 ../../c-api/type.rst:383
418+
#: ../../c-api/type.rst:354 ../../c-api/type.rst:371 ../../c-api/type.rst:387
412419
msgid ""
413420
"The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which "
414421
"may result in incomplete initialization. Creating classes whose metaclass "
415422
"overrides :c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ "
416423
"it will be no longer allowed."
417424
msgstr ""
418425

419-
#: ../../c-api/type.rst:358
426+
#: ../../c-api/type.rst:362
420427
msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``."
421428
msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。"
422429

423-
#: ../../c-api/type.rst:375
430+
#: ../../c-api/type.rst:379
424431
msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``."
425432
msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。"
426433

427-
#: ../../c-api/type.rst:379
434+
#: ../../c-api/type.rst:383
428435
msgid ""
429436
"The function now finds and uses a metaclass corresponding to the base "
430437
"classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` "
431438
"instances were returned."
432439
msgstr ""
433440

434-
#: ../../c-api/type.rst:400
441+
#: ../../c-api/type.rst:404
435442
msgid "Structure defining a type's behavior."
436443
msgstr ""
437444

438-
#: ../../c-api/type.rst:404
445+
#: ../../c-api/type.rst:408
439446
msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`."
440447
msgstr ""
441448

442-
#: ../../c-api/type.rst:408
449+
#: ../../c-api/type.rst:412
443450
msgid ""
444451
"If positive, specifies the size of the instance in bytes. It is used to set :"
445452
"c:member:`PyTypeObject.tp_basicsize`."
446453
msgstr ""
447454

448-
#: ../../c-api/type.rst:411
455+
#: ../../c-api/type.rst:415
449456
msgid ""
450457
"If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be "
451458
"inherited."
452459
msgstr ""
453460

454-
#: ../../c-api/type.rst:414
461+
#: ../../c-api/type.rst:418
455462
msgid ""
456463
"If negative, the absolute value specifies how much space instances of the "
457464
"class need *in addition* to the superclass. Use :c:func:"
@@ -461,17 +468,17 @@ msgid ""
461468
"requirements."
462469
msgstr ""
463470

464-
#: ../../c-api/type.rst:424
471+
#: ../../c-api/type.rst:428
465472
msgid "Previously, this field could not be negative."
466473
msgstr ""
467474

468-
#: ../../c-api/type.rst:428
475+
#: ../../c-api/type.rst:432
469476
msgid ""
470477
"Size of one element of a variable-size type, in bytes. Used to set :c:member:"
471478
"`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats."
472479
msgstr ""
473480

474-
#: ../../c-api/type.rst:432
481+
#: ../../c-api/type.rst:436
475482
msgid ""
476483
"If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending "
477484
"arbitrary variable-sized classes is dangerous, since some types use a fixed "
@@ -480,154 +487,154 @@ msgid ""
480487
"only possible in the following situations:"
481488
msgstr ""
482489

483-
#: ../../c-api/type.rst:439
490+
#: ../../c-api/type.rst:443
484491
msgid ""
485492
"The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)."
486493
msgstr ""
487494

488-
#: ../../c-api/type.rst:441
495+
#: ../../c-api/type.rst:445
489496
msgid ""
490497
"The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that "
491498
"the memory layout of the base class is known."
492499
msgstr ""
493500

494-
#: ../../c-api/type.rst:443
501+
#: ../../c-api/type.rst:447
495502
msgid ""
496503
"The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the "
497504
"subclass does not access the instance's memory directly."
498505
msgstr ""
499506

500-
#: ../../c-api/type.rst:446
507+
#: ../../c-api/type.rst:450
501508
msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag."
502509
msgstr ""
503510

504-
#: ../../c-api/type.rst:450
511+
#: ../../c-api/type.rst:454
505512
msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`."
506513
msgstr ""
507514

508-
#: ../../c-api/type.rst:452
515+
#: ../../c-api/type.rst:456
509516
msgid ""
510517
"If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:"
511518
"`PyType_FromSpecWithBases` sets it automatically."
512519
msgstr ""
513520

514-
#: ../../c-api/type.rst:457
521+
#: ../../c-api/type.rst:461
515522
msgid ""
516523
"Array of :c:type:`PyType_Slot` structures. Terminated by the special slot "
517524
"value ``{0, NULL}``."
518525
msgstr ""
519526

520-
#: ../../c-api/type.rst:460
527+
#: ../../c-api/type.rst:464
521528
msgid "Each slot ID should be specified at most once."
522529
msgstr ""
523530

524-
#: ../../c-api/type.rst:470
531+
#: ../../c-api/type.rst:474
525532
msgid ""
526533
"Structure defining optional functionality of a type, containing a slot ID "
527534
"and a value pointer."
528535
msgstr ""
529536

530-
#: ../../c-api/type.rst:475
537+
#: ../../c-api/type.rst:479
531538
msgid "A slot ID."
532539
msgstr ""
533540

534-
#: ../../c-api/type.rst:477
541+
#: ../../c-api/type.rst:481
535542
msgid ""
536543
"Slot IDs are named like the field names of the structures :c:type:"
537544
"`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:"
538545
"type:`PyMappingMethods` and :c:type:`PyAsyncMethods` with an added ``Py_`` "
539546
"prefix. For example, use:"
540547
msgstr ""
541548

542-
#: ../../c-api/type.rst:483
549+
#: ../../c-api/type.rst:487
543550
msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`"
544551
msgstr ""
545552

546-
#: ../../c-api/type.rst:484
553+
#: ../../c-api/type.rst:488
547554
msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`"
548555
msgstr ""
549556

550-
#: ../../c-api/type.rst:485
557+
#: ../../c-api/type.rst:489
551558
msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`"
552559
msgstr ""
553560

554-
#: ../../c-api/type.rst:487
561+
#: ../../c-api/type.rst:491
555562
msgid ""
556563
"The following “offset” fields cannot be set using :c:type:`PyType_Slot`:"
557564
msgstr ""
558565

559-
#: ../../c-api/type.rst:489
566+
#: ../../c-api/type.rst:493
560567
msgid ""
561568
":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:"
562569
"`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)"
563570
msgstr ""
564571

565-
#: ../../c-api/type.rst:491
572+
#: ../../c-api/type.rst:495
566573
msgid ""
567574
":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:"
568575
"`Py_TPFLAGS_MANAGED_DICT` instead if possible)"
569576
msgstr ""
570577
":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:"
571578
"`Py_TPFLAGS_MANAGED_DICT`)"
572579

573-
#: ../../c-api/type.rst:493
580+
#: ../../c-api/type.rst:497
574581
msgid ""
575582
":c:member:`~PyTypeObject.tp_vectorcall_offset` (use "
576583
"``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef <pymemberdef-offsets>`)"
577584
msgstr ""
578585
":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef "
579586
"<pymemberdef-offsets>` 中的 ``\"__vectorcalloffset__\"``)"
580587

581-
#: ../../c-api/type.rst:497
588+
#: ../../c-api/type.rst:501
582589
msgid ""
583590
"If it is not possible to switch to a ``MANAGED`` flag (for example, for "
584591
"vectorcall or to support Python older than 3.12), specify the offset in :c:"
585592
"member:`Py_tp_members <PyTypeObject.tp_members>`. See :ref:`PyMemberDef "
586593
"documentation <pymemberdef-offsets>` for details."
587594
msgstr ""
588595

589-
#: ../../c-api/type.rst:503
596+
#: ../../c-api/type.rst:507
590597
msgid "The following fields cannot be set at all when creating a heap type:"
591598
msgstr ""
592599

593-
#: ../../c-api/type.rst:505
600+
#: ../../c-api/type.rst:509
594601
msgid ""
595602
":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject."
596603
"tp_new` and/or :c:member:`~PyTypeObject.tp_init`)"
597604
msgstr ""
598605

599-
#: ../../c-api/type.rst:509
606+
#: ../../c-api/type.rst:513
600607
msgid ""
601608
"Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject."
602609
"tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject."
603610
"tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`."
604611
msgstr ""
605612

606-
#: ../../c-api/type.rst:516
613+
#: ../../c-api/type.rst:520
607614
msgid ""
608615
"Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on "
609616
"some platforms. To avoid issues, use the *bases* argument of :c:func:"
610617
"`PyType_FromSpecWithBases` instead."
611618
msgstr ""
612619

613-
#: ../../c-api/type.rst:521
620+
#: ../../c-api/type.rst:525
614621
msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API."
615622
msgstr ""
616623

617-
#: ../../c-api/type.rst:524
624+
#: ../../c-api/type.rst:528
618625
msgid ""
619626
":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs."
620627
"bf_releasebuffer` are now available under the :ref:`limited API <limited-c-"
621628
"api>`."
622629
msgstr ""
623630

624-
#: ../../c-api/type.rst:531
631+
#: ../../c-api/type.rst:535
625632
msgid ""
626633
"The desired value of the slot. In most cases, this is a pointer to a "
627634
"function."
628635
msgstr ""
629636

630-
#: ../../c-api/type.rst:534
637+
#: ../../c-api/type.rst:538
631638
msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``."
632639
msgstr ""
633640

0 commit comments

Comments
 (0)