Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbc97212

Browse files
sync with cpython 648198c3
1 parentf7206f9 commitbc97212

File tree

2 files changed

+741
-575
lines changed

2 files changed

+741
-575
lines changed

‎library/weakref.po

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version:Python 3.12\n"
99
"Report-Msgid-Bugs-To:\n"
10-
"POT-Creation-Date:2022-12-22 00:15+0000\n"
10+
"POT-Creation-Date:2023-09-27 00:04+0000\n"
1111
"PO-Revision-Date:2018-05-23 16:15+0000\n"
1212
"Last-Translator:Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -160,7 +160,7 @@ msgstr ""
160160
msgid""
161161
"Exceptions raised by the callback will be noted on the standard error "
162162
"output, but cannot be propagated; they are handled in exactly the same way "
163-
"as exceptions raised from an object's :meth:`__del__` method."
163+
"as exceptions raised from an object's :meth:`~object.__del__` method."
164164
msgstr""
165165

166166
#:../../library/weakref.rst:116
@@ -284,21 +284,20 @@ msgstr ""
284284
#:../../library/weakref.rst:223
285285
msgid""
286286
":class:`WeakValueDictionary` objects have an additional method that has the "
287-
"same issues as the :meth:`keyrefs` method of :class:`WeakKeyDictionary` "
288-
"objects."
287+
"same issues as the :meth:`WeakKeyDictionary.keyrefs` method."
289288
msgstr""
290289

291-
#:../../library/weakref.rst:230
290+
#:../../library/weakref.rst:229
292291
msgid"Return an iterable of the weak references to the values."
293292
msgstr""
294293

295-
#:../../library/weakref.rst:235
294+
#:../../library/weakref.rst:234
296295
msgid""
297296
"Set class that keeps weak references to its elements. An element will be "
298297
"discarded when no strong reference to it exists any more."
299298
msgstr""
300299

301-
#:../../library/weakref.rst:241
300+
#:../../library/weakref.rst:240
302301
msgid""
303302
"A custom :class:`ref` subclass which simulates a weak reference to a bound "
304303
"method (i.e., a method defined on a class and looked up on an instance). "
@@ -307,149 +306,149 @@ msgid ""
307306
"method until either the object or the original function dies::"
308307
msgstr""
309308

310-
#:../../library/weakref.rst:265
309+
#:../../library/weakref.rst:264
311310
msgid""
312311
"*callback* is the same as the parameter of the same name to the :func:`ref` "
313312
"function."
314313
msgstr""
315314

316-
#:../../library/weakref.rst:271
315+
#:../../library/weakref.rst:270
317316
msgid""
318317
"Return a callable finalizer object which will be called when *obj* is "
319318
"garbage collected. Unlike an ordinary weak reference, a finalizer will "
320319
"always survive until the reference object is collected, greatly simplifying "
321320
"lifecycle management."
322321
msgstr""
323322

324-
#:../../library/weakref.rst:276
323+
#:../../library/weakref.rst:275
325324
msgid""
326325
"A finalizer is considered *alive* until it is called (either explicitly or "
327326
"at garbage collection), and after that it is *dead*. Calling a live "
328327
"finalizer returns the result of evaluating ``func(*arg, **kwargs)``, whereas "
329328
"calling a dead finalizer returns :const:`None`."
330329
msgstr""
331330

332-
#:../../library/weakref.rst:281
331+
#:../../library/weakref.rst:280
333332
msgid""
334333
"Exceptions raised by finalizer callbacks during garbage collection will be "
335334
"shown on the standard error output, but cannot be propagated. They are "
336-
"handled in the same way as exceptions raised from an object's :meth:"
337-
"`__del__` method or a weak reference's callback."
335+
"handled in the same way as exceptions raised from an object's :meth:`~object."
336+
"__del__` method or a weak reference's callback."
338337
msgstr""
339338

340-
#:../../library/weakref.rst:287
339+
#:../../library/weakref.rst:286
341340
msgid""
342341
"When the program exits, each remaining live finalizer is called unless its :"
343342
"attr:`atexit` attribute has been set to false. They are called in reverse "
344343
"order of creation."
345344
msgstr""
346345

347-
#:../../library/weakref.rst:291
346+
#:../../library/weakref.rst:290
348347
msgid""
349348
"A finalizer will never invoke its callback during the later part of the :"
350349
"term:`interpreter shutdown` when module globals are liable to have been "
351350
"replaced by :const:`None`."
352351
msgstr""
353352

354-
#:../../library/weakref.rst:297
353+
#:../../library/weakref.rst:296
355354
msgid""
356355
"If *self* is alive then mark it as dead and return the result of calling "
357356
"``func(*args, **kwargs)``. If *self* is dead then return :const:`None`."
358357
msgstr""
359358

360-
#:../../library/weakref.rst:303
359+
#:../../library/weakref.rst:302
361360
msgid""
362361
"If *self* is alive then mark it as dead and return the tuple ``(obj, func, "
363362
"args, kwargs)``. If *self* is dead then return :const:`None`."
364363
msgstr""
365364

366-
#:../../library/weakref.rst:309
365+
#:../../library/weakref.rst:308
367366
msgid""
368367
"If *self* is alive then return the tuple ``(obj, func, args, kwargs)``. If "
369368
"*self* is dead then return :const:`None`."
370369
msgstr""
371370

372-
#:../../library/weakref.rst:314
371+
#:../../library/weakref.rst:313
373372
msgid"Property which is true if the finalizer is alive, false otherwise."
374373
msgstr""
375374

376-
#:../../library/weakref.rst:318
375+
#:../../library/weakref.rst:317
377376
msgid""
378377
"A writable boolean property which by default is true. When the program "
379378
"exits, it calls all remaining live finalizers for which :attr:`.atexit` is "
380379
"true. They are called in reverse order of creation."
381380
msgstr""
382381

383-
#:../../library/weakref.rst:325
382+
#:../../library/weakref.rst:324
384383
msgid""
385384
"It is important to ensure that *func*, *args* and *kwargs* do not own any "
386385
"references to *obj*, either directly or indirectly, since otherwise *obj* "
387386
"will never be garbage collected. In particular, *func* should not be a "
388387
"bound method of *obj*."
389388
msgstr""
390389

391-
#:../../library/weakref.rst:335
390+
#:../../library/weakref.rst:334
392391
msgid"The type object for weak references objects."
393392
msgstr""
394393

395-
#:../../library/weakref.rst:340
394+
#:../../library/weakref.rst:339
396395
msgid"The type object for proxies of objects which are not callable."
397396
msgstr""
398397

399-
#:../../library/weakref.rst:345
398+
#:../../library/weakref.rst:344
400399
msgid"The type object for proxies of callable objects."
401400
msgstr""
402401

403-
#:../../library/weakref.rst:350
402+
#:../../library/weakref.rst:349
404403
msgid""
405404
"Sequence containing all the type objects for proxies. This can make it "
406405
"simpler to test if an object is a proxy without being dependent on naming "
407406
"both proxy types."
408407
msgstr""
409408

410-
#:../../library/weakref.rst:358
409+
#:../../library/weakref.rst:357
411410
msgid":pep:`205` - Weak References"
412411
msgstr""
413412

414-
#:../../library/weakref.rst:358
413+
#:../../library/weakref.rst:357
415414
msgid""
416415
"The proposal and rationale for this feature, including links to earlier "
417416
"implementations and information about similar features in other languages."
418417
msgstr""
419418

420-
#:../../library/weakref.rst:365
419+
#:../../library/weakref.rst:364
421420
msgid"Weak Reference Objects"
422421
msgstr""
423422

424-
#:../../library/weakref.rst:367
423+
#:../../library/weakref.rst:366
425424
msgid""
426425
"Weak reference objects have no methods and no attributes besides :attr:`ref."
427426
"__callback__`. A weak reference object allows the referent to be obtained, "
428427
"if it still exists, by calling it:"
429428
msgstr""
430429

431-
#:../../library/weakref.rst:381
430+
#:../../library/weakref.rst:380
432431
msgid""
433432
"If the referent no longer exists, calling the reference object returns :"
434433
"const:`None`:"
435434
msgstr""
436435

437-
#:../../library/weakref.rst:388
436+
#:../../library/weakref.rst:387
438437
msgid""
439438
"Testing that a weak reference object is still live should be done using the "
440439
"expression ``ref() is not None``. Normally, application code that needs to "
441440
"use a reference object should follow this pattern::"
442441
msgstr""
443442

444-
#:../../library/weakref.rst:401
443+
#:../../library/weakref.rst:400
445444
msgid""
446445
"Using a separate test for\"liveness\" creates race conditions in threaded "
447446
"applications; another thread can cause a weak reference to become "
448447
"invalidated before the weak reference is called; the idiom shown above is "
449448
"safe in threaded applications as well as single-threaded applications."
450449
msgstr""
451450

452-
#:../../library/weakref.rst:406
451+
#:../../library/weakref.rst:405
453452
msgid""
454453
"Specialized versions of :class:`ref` objects can be created through "
455454
"subclassing. This is used in the implementation of the :class:"
@@ -459,122 +458,122 @@ msgid ""
459458
"to retrieve the referent."
460459
msgstr""
461460

462-
#:../../library/weakref.rst:412
461+
#:../../library/weakref.rst:411
463462
msgid""
464463
"This example shows how a subclass of :class:`ref` can be used to store "
465464
"additional information about an object and affect the value that's returned "
466465
"when the referent is accessed::"
467466
msgstr""
468467

469-
#:../../library/weakref.rst:439
468+
#:../../library/weakref.rst:438
470469
msgid"Example"
471470
msgstr"範例"
472471

473-
#:../../library/weakref.rst:441
472+
#:../../library/weakref.rst:440
474473
msgid""
475474
"This simple example shows how an application can use object IDs to retrieve "
476475
"objects that it has seen before. The IDs of the objects can then be used in "
477476
"other data structures without forcing the objects to remain alive, but the "
478477
"objects can still be retrieved by ID if they do."
479478
msgstr""
480479

481-
#:../../library/weakref.rst:466
480+
#:../../library/weakref.rst:465
482481
msgid"Finalizer Objects"
483482
msgstr""
484483

485-
#:../../library/weakref.rst:468
484+
#:../../library/weakref.rst:467
486485
msgid""
487486
"The main benefit of using :class:`finalize` is that it makes it simple to "
488487
"register a callback without needing to preserve the returned finalizer "
489488
"object. For instance"
490489
msgstr""
491490

492-
#:../../library/weakref.rst:482
491+
#:../../library/weakref.rst:481
493492
msgid""
494493
"The finalizer can be called directly as well. However the finalizer will "
495494
"invoke the callback at most once."
496495
msgstr""
497496

498-
#:../../library/weakref.rst:498
497+
#:../../library/weakref.rst:497
499498
msgid""
500499
"You can unregister a finalizer using its :meth:`~finalize.detach` method. "
501500
"This kills the finalizer and returns the arguments passed to the constructor "
502501
"when it was created."
503502
msgstr""
504503

505-
#:../../library/weakref.rst:512
504+
#:../../library/weakref.rst:511
506505
msgid""
507506
"Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a "
508507
"finalizer will be called when the program exits if it is still alive. For "
509508
"instance"
510509
msgstr""
511510

512-
#:../../library/weakref.rst:527
513-
msgid"Comparing finalizers with :meth:`__del__` methods"
511+
#:../../library/weakref.rst:526
512+
msgid"Comparing finalizers with :meth:`~object.__del__` methods"
514513
msgstr""
515514

516-
#:../../library/weakref.rst:529
515+
#:../../library/weakref.rst:528
517516
msgid""
518517
"Suppose we want to create a class whose instances represent temporary "
519518
"directories. The directories should be deleted with their contents when the "
520519
"first of the following events occurs:"
521520
msgstr""
522521

523-
#:../../library/weakref.rst:533
522+
#:../../library/weakref.rst:532
524523
msgid"the object is garbage collected,"
525524
msgstr""
526525

527-
#:../../library/weakref.rst:534
528-
msgid"the object's :meth:`remove` method is called, or"
526+
#:../../library/weakref.rst:533
527+
msgid"the object's :meth:`!remove` method is called, or"
529528
msgstr""
530529

531-
#:../../library/weakref.rst:535
530+
#:../../library/weakref.rst:534
532531
msgid"the program exits."
533532
msgstr""
534533

535-
#:../../library/weakref.rst:537
534+
#:../../library/weakref.rst:536
536535
msgid""
537-
"We might try to implement the class using a :meth:`__del__` method as "
538-
"follows::"
536+
"We might try to implement the class using a :meth:`~object.__del__` method "
537+
"asfollows::"
539538
msgstr""
540539

541-
#:../../library/weakref.rst:556
540+
#:../../library/weakref.rst:555
542541
msgid""
543-
"Starting with Python 3.4, :meth:`__del__` methods no longer prevent "
542+
"Starting with Python 3.4, :meth:`~object.__del__` methods no longer prevent "
544543
"reference cycles from being garbage collected, and module globals are no "
545544
"longer forced to :const:`None` during :term:`interpreter shutdown`. So this "
546545
"code should work without any issues on CPython."
547546
msgstr""
548547

549-
#:../../library/weakref.rst:561
548+
#:../../library/weakref.rst:560
550549
msgid""
551-
"However, handling of :meth:`__del__` methods is notoriously implementation "
552-
"specific, since it depends on internal details of the interpreter's garbage "
553-
"collector implementation."
550+
"However, handling of :meth:`~object.__del__` methods is notoriously "
551+
"implementationspecific, since it depends on internal details of the "
552+
"interpreter's garbagecollector implementation."
554553
msgstr""
555554

556-
#:../../library/weakref.rst:565
555+
#:../../library/weakref.rst:564
557556
msgid""
558557
"A more robust alternative can be to define a finalizer which only references "
559558
"the specific functions and objects that it needs, rather than having access "
560559
"to the full state of the object::"
561560
msgstr""
562561

563-
#:../../library/weakref.rst:581
562+
#:../../library/weakref.rst:580
564563
msgid""
565564
"Defined like this, our finalizer only receives a reference to the details it "
566565
"needs to clean up the directory appropriately. If the object never gets "
567566
"garbage collected the finalizer will still be called at exit."
568567
msgstr""
569568

570-
#:../../library/weakref.rst:585
569+
#:../../library/weakref.rst:584
571570
msgid""
572571
"The other advantage of weakref based finalizers is that they can be used to "
573572
"register finalizers for classes where the definition is controlled by a "
574573
"third party, such as running code when a module is unloaded::"
575574
msgstr""
576575

577-
#:../../library/weakref.rst:597
576+
#:../../library/weakref.rst:596
578577
msgid""
579578
"If you create a finalizer object in a daemonic thread just as the program "
580579
"exits then there is the possibility that the finalizer does not get called "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp