forked from python/python-docs-zh-tw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsys.monitoring.po
More file actions
737 lines (618 loc) · 28.2 KB
/
sys.monitoring.po
File metadata and controls
737 lines (618 loc) · 28.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# Translators:
# Matt Wang <mattwang44@gmail.com>, 2024-2025
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-04-11 16:06+0000\n"
"PO-Revision-Date: 2025-11-07 17:51+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../library/sys.monitoring.rst:2
msgid ":mod:`!sys.monitoring` --- Execution event monitoring"
msgstr ":mod:`!sys.monitoring` --- 執行事件監控"
#: ../../library/sys.monitoring.rst:13
msgid ""
":mod:`!sys.monitoring` is a namespace within the :mod:`sys` module, not an "
"independent module, and ``import sys.monitoring`` would fail with a :exc:"
"`ModuleNotFoundError`. Instead, simply ``import sys`` and then use ``sys."
"monitoring``."
msgstr ""
":mod:`!sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模"
"組,而 ``import sys.monitoring`` 將引發\\ :exc:`ModuleNotFoundError`。只需 "
"``import sys`` 然後使用 ``sys.monitoring``。"
#: ../../library/sys.monitoring.rst:19
msgid ""
"This namespace provides access to the functions and constants necessary to "
"activate and control event monitoring."
msgstr "此命名空間提供對啟動和控制事件監控所需的函式和常數的存取。"
#: ../../library/sys.monitoring.rst:22
msgid ""
"As programs execute, events occur that might be of interest to tools that "
"monitor execution. The :mod:`!sys.monitoring` namespace provides means to "
"receive callbacks when events of interest occur."
msgstr ""
"當程式執行時,會發生一些能被監控工具關注的事件。:mod:`!sys.monitoring` 命名空"
"間提供了在發生欲關注事件時接收回呼的方法。"
#: ../../library/sys.monitoring.rst:26
msgid "The monitoring API consists of three components:"
msgstr "監控 API 由三個元件組成:"
#: ../../library/sys.monitoring.rst:28
msgid "`Tool identifiers`_"
msgstr "`工具識別器 <Tool identifiers_>`_"
#: ../../library/sys.monitoring.rst:29
msgid "`Events`_"
msgstr "`事件 <Events_>`_"
#: ../../library/sys.monitoring.rst:30
msgid ":ref:`Callbacks <callbacks>`"
msgstr ":ref:`回呼 (callbacks) <callbacks>`"
#: ../../library/sys.monitoring.rst:33
msgid "Tool identifiers"
msgstr "工具識別器"
#: ../../library/sys.monitoring.rst:35
msgid ""
"A tool identifier is an integer and the associated name. Tool identifiers "
"are used to discourage tools from interfering with each other and to allow "
"multiple tools to operate at the same time. Currently tools are completely "
"independent and cannot be used to monitor each other. This restriction may "
"be lifted in the future."
msgstr ""
"工具識別器是一個整數和關聯的名稱。工具識別器用於防止工具相互干擾並允許多個工"
"具同時運作。目前工具是完全獨立的,不能用來互相監控。將來此限制可能會取消。"
#: ../../library/sys.monitoring.rst:41
msgid ""
"Before registering or activating events, a tool should choose an identifier. "
"Identifiers are integers in the range 0 to 5 inclusive."
msgstr ""
"在註冊或啟動事件之前,工具應選擇一個識別器。識別器是 0 到 5(含)範圍內的整"
"數。"
#: ../../library/sys.monitoring.rst:45
msgid "Registering and using tools"
msgstr "註冊和使用工具"
#: ../../library/sys.monitoring.rst:49
msgid ""
"Must be called before *tool_id* can be used. *tool_id* must be in the range "
"0 to 5 inclusive. Raises a :exc:`ValueError` if *tool_id* is in use."
msgstr ""
"必須在使用 *tool_id* 之前呼叫。*tool_id* 必須在 0 到 5(含)範圍內。如果 "
"*tool_id* 正在使用,則引發 :exc:`ValueError`。"
#: ../../library/sys.monitoring.rst:55
msgid "Unregister all events and callback functions associated with *tool_id*."
msgstr "取消註冊與 *tool_id* 關聯的所有事件和回呼函式。"
#: ../../library/sys.monitoring.rst:59
msgid ""
"Should be called once a tool no longer requires *tool_id*. Will call :func:"
"`clear_tool_id` before releasing *tool_id*."
msgstr ""
"一旦工具不再需要 *tool_id* 就應該被呼叫。在釋放 *tool_id* 之前會呼叫 :func:"
"`clear_tool_id`。"
#: ../../library/sys.monitoring.rst:64
msgid ""
"Returns the name of the tool if *tool_id* is in use, otherwise it returns "
"``None``. *tool_id* must be in the range 0 to 5 inclusive."
msgstr ""
"如果 *tool_id* 正在使用,則回傳該工具的名稱,否則回傳 ``None``。*tool_id* 必"
"須在 0 到 5(含)範圍內。"
#: ../../library/sys.monitoring.rst:68
msgid ""
"All IDs are treated the same by the VM with regard to events, but the "
"following IDs are pre-defined to make co-operation of tools easier::"
msgstr ""
"對於事件,虛擬機器對所有 ID 的處理都是相同的,但預先定義了以下 ID,以使工具間"
"的協作更容易: ::"
#: ../../library/sys.monitoring.rst:71
msgid ""
"sys.monitoring.DEBUGGER_ID = 0\n"
"sys.monitoring.COVERAGE_ID = 1\n"
"sys.monitoring.PROFILER_ID = 2\n"
"sys.monitoring.OPTIMIZER_ID = 5"
msgstr ""
"sys.monitoring.DEBUGGER_ID = 0\n"
"sys.monitoring.COVERAGE_ID = 1\n"
"sys.monitoring.PROFILER_ID = 2\n"
"sys.monitoring.OPTIMIZER_ID = 5"
#: ../../library/sys.monitoring.rst:78
msgid "Events"
msgstr "事件"
#: ../../library/sys.monitoring.rst:80
msgid "The following events are supported:"
msgstr "支援以下事件:"
#: ../../library/sys.monitoring.rst:84
msgid "A conditional branch goes left."
msgstr "一個條件分支往左。"
#: ../../library/sys.monitoring.rst:86
msgid ""
"It is up to the tool to determine how to present \"left\" and \"right\" "
"branches. There is no guarantee which branch is \"left\" and which is "
"\"right\", except that it will be consistent for the duration of the program."
msgstr ""
#: ../../library/sys.monitoring.rst:92
msgid "A conditional branch goes right."
msgstr "一個條件分支往右。"
#: ../../library/sys.monitoring.rst:96
msgid "A call in Python code (event occurs before the call)."
msgstr "Python 程式碼中的呼叫(事件發生在呼叫之前)。"
#: ../../library/sys.monitoring.rst:100
msgid ""
"An exception raised from any callable, except for Python functions (event "
"occurs after the exit)."
msgstr "從任何可呼叫物件引發的例外,除 Python 函式外(事件發生在退出之後)。"
#: ../../library/sys.monitoring.rst:104
msgid ""
"Return from any callable, except for Python functions (event occurs after "
"the return)."
msgstr "從任何可呼叫函式回傳,除 Python 函式外(事件發生在回傳之後)。"
#: ../../library/sys.monitoring.rst:108
msgid "An exception is handled."
msgstr "一個例外被處理。"
#: ../../library/sys.monitoring.rst:112
msgid "A VM instruction is about to be executed."
msgstr "虛擬機器指令即將被執行。"
#: ../../library/sys.monitoring.rst:116
msgid "An unconditional jump in the control flow graph is made."
msgstr "在控制流程圖中進行無條件跳轉。"
#: ../../library/sys.monitoring.rst:120
msgid ""
"An instruction is about to be executed that has a different line number from "
"the preceding instruction."
msgstr "即將執行的指令與前一條指令的列號不同。"
#: ../../library/sys.monitoring.rst:124
msgid ""
"Resumption of a Python function (for generator and coroutine functions), "
"except for ``throw()`` calls."
msgstr "Python 函式的繼續執行(對於產生器和協程函式),除了 ``throw()`` 呼叫。"
#: ../../library/sys.monitoring.rst:128
msgid ""
"Return from a Python function (occurs immediately before the return, the "
"callee's frame will be on the stack)."
msgstr ""
"從 Python 函式回傳(發生在即將回傳之前,被呼叫者的 frame 將位於堆疊上)。"
#: ../../library/sys.monitoring.rst:132
msgid ""
"Start of a Python function (occurs immediately after the call, the callee's "
"frame will be on the stack)"
msgstr "Python 函式的開始(在呼叫後立即發生,被呼叫者的 frame 將位於堆疊上)"
#: ../../library/sys.monitoring.rst:136
msgid "A Python function is resumed by a ``throw()`` call."
msgstr "Python 函式透過 ``throw()`` 呼叫來繼續。"
#: ../../library/sys.monitoring.rst:140
msgid ""
"Exit from a Python function during exception unwinding. This includes "
"exceptions raised directly within the function and that are allowed to "
"continue to propagate."
msgstr ""
#: ../../library/sys.monitoring.rst:145
msgid ""
"Yield from a Python function (occurs immediately before the yield, the "
"callee's frame will be on the stack)."
msgstr ""
"來自 Python 函式的 yield(在即將 yield 之前發生,被呼叫者的 frame 將位於堆疊"
"上)。"
#: ../../library/sys.monitoring.rst:149
msgid ""
"An exception is raised, except those that cause a :monitoring-event:"
"`STOP_ITERATION` event."
msgstr ""
"例外被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。"
#: ../../library/sys.monitoring.rst:153
msgid ""
"An exception is re-raised, for example at the end of a :keyword:`finally` "
"block."
msgstr "例外被重新引發 (re-raise),例如在 :keyword:`finally` 區塊的最後。"
#: ../../library/sys.monitoring.rst:157
msgid ""
"An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION "
"event`_."
msgstr ""
"一個人為的 :exc:`StopIteration` 被引發;請參閱 `STOP_ITERATION 事件 <the "
"STOP_ITERATION event_>`_。"
#: ../../library/sys.monitoring.rst:160
msgid "More events may be added in the future."
msgstr "將來可能會新增更多事件。"
#: ../../library/sys.monitoring.rst:162
msgid ""
"These events are attributes of the :mod:`!sys.monitoring.events` namespace. "
"Each event is represented as a power-of-2 integer constant. To define a set "
"of events, simply bitwise OR the individual events together. For example, to "
"specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START` "
"events, use the expression ``PY_RETURN | PY_START``."
msgstr ""
"這些事件是 :mod:`!sys.monitoring.events` 命名空間的屬性。每個事件以 2 次方的"
"整數常數表示。要定義一組事件,只要將個別事件以 bitwise OR 相接即可。例如,若"
"要指定 :monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_START` 兩個事"
"件,請使用運算式 ``PY_RETURN | PY_START``。"
#: ../../library/sys.monitoring.rst:170
msgid "An alias for ``0`` so users can do explicit comparisons like::"
msgstr "``0`` 的別名,以便使用者可以進行明確比較,例如: ::"
#: ../../library/sys.monitoring.rst:172
msgid ""
"if get_events(DEBUGGER_ID) == NO_EVENTS:\n"
" ..."
msgstr ""
"if get_events(DEBUGGER_ID) == NO_EVENTS:\n"
" ..."
#: ../../library/sys.monitoring.rst:175
msgid "Setting this event deactivates all events."
msgstr "設定此事件會停用所有事件。"
#: ../../library/sys.monitoring.rst:180
msgid "Local events"
msgstr "區域事件"
#: ../../library/sys.monitoring.rst:182
msgid ""
"Local events are associated with normal execution of the program and happen "
"at clearly defined locations. All local events can be disabled. The local "
"events are:"
msgstr ""
"區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停"
"用。區域事件有:"
#: ../../library/sys.monitoring.rst:186
msgid ":monitoring-event:`PY_START`"
msgstr ":monitoring-event:`PY_START`"
#: ../../library/sys.monitoring.rst:187
msgid ":monitoring-event:`PY_RESUME`"
msgstr ":monitoring-event:`PY_RESUME`"
#: ../../library/sys.monitoring.rst:188
msgid ":monitoring-event:`PY_RETURN`"
msgstr ":monitoring-event:`PY_RETURN`"
#: ../../library/sys.monitoring.rst:189
msgid ":monitoring-event:`PY_YIELD`"
msgstr ":monitoring-event:`PY_YIELD`"
#: ../../library/sys.monitoring.rst:190
msgid ":monitoring-event:`CALL`"
msgstr ":monitoring-event:`CALL`"
#: ../../library/sys.monitoring.rst:191
msgid ":monitoring-event:`LINE`"
msgstr ":monitoring-event:`LINE`"
#: ../../library/sys.monitoring.rst:192
msgid ":monitoring-event:`INSTRUCTION`"
msgstr ":monitoring-event:`INSTRUCTION`"
#: ../../library/sys.monitoring.rst:193
msgid ":monitoring-event:`JUMP`"
msgstr ":monitoring-event:`JUMP`"
#: ../../library/sys.monitoring.rst:194
msgid ":monitoring-event:`BRANCH_LEFT`"
msgstr ":monitoring-event:`BRANCH_LEFT`"
#: ../../library/sys.monitoring.rst:195
msgid ":monitoring-event:`BRANCH_RIGHT`"
msgstr ":monitoring-event:`BRANCH_RIGHT`"
#: ../../library/sys.monitoring.rst:196
msgid ":monitoring-event:`STOP_ITERATION`"
msgstr ":monitoring-event:`STOP_ITERATION`"
#: ../../library/sys.monitoring.rst:199
msgid "Deprecated event"
msgstr "已棄用的事件"
#: ../../library/sys.monitoring.rst:201
msgid "``BRANCH``"
msgstr "``BRANCH``"
#: ../../library/sys.monitoring.rst:203
msgid ""
"The ``BRANCH`` event is deprecated in 3.14. Using :monitoring-event:"
"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events will give much "
"better performance as they can be disabled independently."
msgstr ""
#: ../../library/sys.monitoring.rst:209
msgid "Ancillary events"
msgstr "附屬事件 (ancillary events)"
#: ../../library/sys.monitoring.rst:211
msgid ""
"Ancillary events can be monitored like other events, but are controlled by "
"another event:"
msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:"
#: ../../library/sys.monitoring.rst:214
msgid ":monitoring-event:`C_RAISE`"
msgstr ":monitoring-event:`C_RAISE`"
#: ../../library/sys.monitoring.rst:215
msgid ":monitoring-event:`C_RETURN`"
msgstr ":monitoring-event:`C_RETURN`"
#: ../../library/sys.monitoring.rst:217
msgid ""
"The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are "
"controlled by the :monitoring-event:`CALL` event. :monitoring-event:"
"`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if the "
"corresponding :monitoring-event:`CALL` event is being monitored."
msgstr ""
":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件由 :"
"monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` 事件"
"受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:"
"`C_RAISE` 事件。"
#: ../../library/sys.monitoring.rst:226
msgid "Other events"
msgstr "其他事件"
#: ../../library/sys.monitoring.rst:228
msgid ""
"Other events are not necessarily tied to a specific location in the program "
"and cannot be individually disabled via :data:`DISABLE`."
msgstr ""
"其他事件不一定與程式中的特定位置相關聯,也不能透過 :data:`DISABLE` 單獨停用。"
#: ../../library/sys.monitoring.rst:231
msgid "The other events that can be monitored are:"
msgstr "其他可以監控的事件有:"
#: ../../library/sys.monitoring.rst:233
msgid ":monitoring-event:`PY_THROW`"
msgstr ":monitoring-event:`PY_THROW`"
#: ../../library/sys.monitoring.rst:234
msgid ":monitoring-event:`PY_UNWIND`"
msgstr ":monitoring-event:`PY_UNWIND`"
#: ../../library/sys.monitoring.rst:235
msgid ":monitoring-event:`RAISE`"
msgstr ":monitoring-event:`RAISE`"
#: ../../library/sys.monitoring.rst:236
msgid ":monitoring-event:`EXCEPTION_HANDLED`"
msgstr ":monitoring-event:`EXCEPTION_HANDLED`"
#: ../../library/sys.monitoring.rst:240
msgid "The STOP_ITERATION event"
msgstr "STOP_ITERATION 事件"
#: ../../library/sys.monitoring.rst:242
msgid ""
":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :"
"exc:`StopIteration` exception is raised when returning a value from a "
"generator or coroutine. However, this is a very inefficient way to return a "
"value, so some Python implementations, notably CPython 3.12+, do not raise "
"an exception unless it would be visible to other code."
msgstr ""
":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` 指出從產生器或協程"
"回傳值時要引發 :exc:`StopIteration` 例外。然而,這是一種非常低效的回傳值方"
"式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他"
"程式碼是可見的。"
#: ../../library/sys.monitoring.rst:248
msgid ""
"To allow tools to monitor for real exceptions without slowing down "
"generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is "
"provided. :monitoring-event:`STOP_ITERATION` can be locally disabled, "
"unlike :monitoring-event:`RAISE`."
msgstr ""
"為了允許工具去監控真正的例外而不減慢產生器和協程的速度,提供了 :monitoring-"
"event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-"
"event:`STOP_ITERATION` 可以區域停用。"
#: ../../library/sys.monitoring.rst:253
msgid ""
"Note that the :monitoring-event:`STOP_ITERATION` event and the :monitoring-"
"event:`RAISE` event for a :exc:`StopIteration` exception are equivalent, and "
"are treated as interchangeable when generating events. Implementations will "
"favor :monitoring-event:`STOP_ITERATION` for performance reasons, but may "
"generate a :monitoring-event:`RAISE` event with a :exc:`StopIteration`."
msgstr ""
#: ../../library/sys.monitoring.rst:261
msgid "Turning events on and off"
msgstr "開啟和關閉事件"
#: ../../library/sys.monitoring.rst:263
msgid ""
"In order to monitor an event, it must be turned on and a corresponding "
"callback must be registered. Events can be turned on or off by setting the "
"events either globally and/or for a particular code object. An event will "
"trigger only once, even if it is turned on both globally and locally."
msgstr ""
"為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域與/或只"
"為特定程式碼物件來開啟或關閉事件。即使事件在全域和區域都被打開,事件也只會觸"
"發一次。"
#: ../../library/sys.monitoring.rst:270
msgid "Setting events globally"
msgstr "全域設定事件"
#: ../../library/sys.monitoring.rst:272
msgid ""
"Events can be controlled globally by modifying the set of events being "
"monitored."
msgstr "可以透過修改正在監控的事件集合來全域地控制事件。"
#: ../../library/sys.monitoring.rst:276
msgid "Returns the ``int`` representing all the active events."
msgstr "回傳代表所有有效事件的 ``int``。"
#: ../../library/sys.monitoring.rst:280
msgid ""
"Activates all events which are set in *event_set*. Raises a :exc:"
"`ValueError` if *tool_id* is not in use."
msgstr ""
"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :"
"exc:`ValueError`。"
#: ../../library/sys.monitoring.rst:283
msgid "No events are active by default."
msgstr "預設沒有有效事件。"
#: ../../library/sys.monitoring.rst:286
msgid "Per code object events"
msgstr "各別程式碼物件事件"
#: ../../library/sys.monitoring.rst:288
msgid ""
"Events can also be controlled on a per code object basis. The functions "
"defined below which accept a :class:`types.CodeType` should be prepared to "
"accept a look-alike object from functions which are not defined in Python "
"(see :ref:`c-api-monitoring`)."
msgstr ""
"事件還可以基於各別程式碼物件進行控制。下面定義的、接受 :class:`types."
"CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :"
"ref:`c-api-monitoring`)。"
#: ../../library/sys.monitoring.rst:295
msgid "Returns all the :ref:`local events <monitoring-event-local>` for *code*"
msgstr "回傳 *code* 的所有\\ :ref:`區域事件 <monitoring-event-local>`"
#: ../../library/sys.monitoring.rst:299
msgid ""
"Activates all the :ref:`local events <monitoring-event-local>` for *code* "
"which are set in *event_set*. Raises a :exc:`ValueError` if *tool_id* is not "
"in use."
msgstr ""
"啟動 *event_set* 中針對 *code* 設定的所有\\ :ref:`區域事件 <monitoring-event-"
"local>`。如果 *tool_id* 並未正在被使用,則引發 :exc:`ValueError`。"
#: ../../library/sys.monitoring.rst:305
msgid "Disabling events"
msgstr "停用事件"
#: ../../library/sys.monitoring.rst:309
msgid ""
"A special value that can be returned from a callback function to disable "
"events for the current code location."
msgstr "可以從回呼函式回傳的特殊值,以停用目前程式碼位置的事件。"
#: ../../library/sys.monitoring.rst:312
msgid ""
":ref:`Local events <monitoring-event-local>` can be disabled for a specific "
"code location by returning :data:`sys.monitoring.DISABLE` from a callback "
"function. This does not change which events are set, or any other code "
"locations for the same event."
msgstr ""
"可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的\\ :"
"ref:`區域事件 <monitoring-event-local>`。這不會改變被設定的事件,或相同事件的"
"任何其他程式碼位置。"
#: ../../library/sys.monitoring.rst:317
msgid ""
"Disabling events for specific locations is very important for high "
"performance monitoring. For example, a program can be run under a debugger "
"with no overhead if the debugger disables all monitoring except for a few "
"breakpoints."
msgstr ""
"停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器"
"可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。"
#: ../../library/sys.monitoring.rst:322
msgid ""
"If :data:`DISABLE` is returned by a callback for a :ref:`global event "
"<monitoring-event-global>`, :exc:`ValueError` will be raised by the "
"interpreter in a non-specific location (that is, no traceback will be "
"provided)."
msgstr ""
"如果回呼是為一個\\ :ref:`全域事件 <monitoring-event-global>`\\ 回傳 :data:"
"`DISABLE`,則直譯器會在非特定位置引發 :exc:`ValueError`\\ (也就是不會提供回"
"溯 (traceback))。"
#: ../../library/sys.monitoring.rst:329
msgid ""
"Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` "
"for all tools."
msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。"
#: ../../library/sys.monitoring.rst:336
msgid "Registering callback functions"
msgstr "註冊回呼函式"
#: ../../library/sys.monitoring.rst:340
msgid "Registers the callable *func* for the *event* with the given *tool_id*"
msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*"
#: ../../library/sys.monitoring.rst:342
msgid ""
"If another callback was registered for the given *tool_id* and *event*, it "
"is unregistered and returned. Otherwise :func:`register_callback` returns "
"``None``."
msgstr ""
"如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否"
"則 :func:`register_callback` 會回傳 ``None``。"
#: ../../library/sys.monitoring.rst:346
msgid ""
"Raises an :ref:`auditing event <auditing>` ``sys.monitoring."
"register_callback`` with argument ``func``."
msgstr ""
"以 ``func`` 引數引發一個\\ :ref:`稽核事件 (auditing event) <auditing>` ``sys."
"monitoring.register_callback``。"
#: ../../library/sys.monitoring.rst:348
msgid ""
"Functions can be unregistered by calling ``sys.monitoring."
"register_callback(tool_id, event, None)``."
msgstr ""
"可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取"
"消註冊函式。"
#: ../../library/sys.monitoring.rst:351
msgid "Callback functions can be registered and unregistered at any time."
msgstr "回呼函式可以隨時被註冊和取消註冊。"
#: ../../library/sys.monitoring.rst:353
msgid ""
"Callbacks are called only once regardless if the event is turned on both "
"globally and locally. As such, if an event could be turned on for both "
"global and local events by your code then the callback needs to be written "
"to handle either trigger."
msgstr ""
#: ../../library/sys.monitoring.rst:360
msgid "Callback function arguments"
msgstr "回呼函式引數"
#: ../../library/sys.monitoring.rst:364
msgid ""
"A special value that is passed to a callback function to indicate that there "
"are no arguments to the call."
msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。"
#: ../../library/sys.monitoring.rst:367
msgid ""
"When an active event occurs, the registered callback function is called. "
"Callback functions returning an object other than :data:`DISABLE` will have "
"no effect. Different events will provide the callback function with "
"different arguments, as follows:"
msgstr ""
"當有效事件發生時,已註冊的回呼函式會被呼叫。回傳非 :data:`DISABLE` 物件的回呼"
"函式將不會有任何效果。不同的事件會為回呼函式提供不同的引數,如下所示:"
#: ../../library/sys.monitoring.rst:371
msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::"
msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::"
#: ../../library/sys.monitoring.rst:373 ../../library/sys.monitoring.rst:410
msgid "func(code: CodeType, instruction_offset: int) -> object"
msgstr "func(code: CodeType, instruction_offset: int) -> object"
#: ../../library/sys.monitoring.rst:375
msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::"
msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::"
#: ../../library/sys.monitoring.rst:377
msgid "func(code: CodeType, instruction_offset: int, retval: object) -> object"
msgstr ""
"func(code: CodeType, instruction_offset: int, retval: object) -> object"
#: ../../library/sys.monitoring.rst:379
msgid ""
":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:"
"`C_RETURN` (*arg0* can be :data:`MISSING` specifically)::"
msgstr ""
":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-event:"
"`C_RETURN`\\ (*arg0* 可以特別是 :data:`MISSING`): ::"
#: ../../library/sys.monitoring.rst:382
msgid ""
"func(code: CodeType, instruction_offset: int, callable: object, arg0: "
"object) -> object"
msgstr ""
"func(code: CodeType, instruction_offset: int, callable: object, arg0: "
"object) -> object"
#: ../../library/sys.monitoring.rst:384
msgid ""
"*code* represents the code object where the call is being made, while "
"*callable* is the object that is about to be called (and thus triggered the "
"event). If there are no arguments, *arg0* is set to :data:`sys.monitoring."
"MISSING`."
msgstr ""
#: ../../library/sys.monitoring.rst:389
msgid ""
"For instance methods, *callable* will be the function object as found on the "
"class with *arg0* set to the instance (i.e. the ``self`` argument to the "
"method)."
msgstr ""
#: ../../library/sys.monitoring.rst:393
msgid ""
":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:"
"`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:"
"`PY_THROW` and :monitoring-event:`STOP_ITERATION`::"
msgstr ""
":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-event:"
"`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-event:"
"`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::"
#: ../../library/sys.monitoring.rst:396
msgid ""
"func(code: CodeType, instruction_offset: int, exception: BaseException) -> "
"object"
msgstr ""
"func(code: CodeType, instruction_offset: int, exception: BaseException) -> "
"object"
#: ../../library/sys.monitoring.rst:398
msgid ":monitoring-event:`LINE`::"
msgstr ":monitoring-event:`LINE`: ::"
#: ../../library/sys.monitoring.rst:400
msgid "func(code: CodeType, line_number: int) -> object"
msgstr "func(code: CodeType, line_number: int) -> object"
#: ../../library/sys.monitoring.rst:402
msgid ""
":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` and :"
"monitoring-event:`JUMP`::"
msgstr ""
":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` and :"
"monitoring-event:`JUMP`::"
#: ../../library/sys.monitoring.rst:404
msgid ""
"func(code: CodeType, instruction_offset: int, destination_offset: int) -> "
"object"
msgstr ""
"func(code: CodeType, instruction_offset: int, destination_offset: int) -> "
"object"
#: ../../library/sys.monitoring.rst:406
msgid "Note that the *destination_offset* is where the code will next execute."
msgstr "請注意,*destination_offset* 是程式碼接下來要執行的地方。"
#: ../../library/sys.monitoring.rst:408
msgid ":monitoring-event:`INSTRUCTION`::"
msgstr ":monitoring-event:`INSTRUCTION`: ::"