diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 99edc3a8a0..c0027b4b12 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -1,16 +1,16 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# Translators: +# Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.13\n" +"Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"PO-Revision-Date: 2024-10-21 17:51+0800\n" +"Last-Translator: Matt Wang \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" @@ -18,7 +18,7 @@ msgstr "" #: ../../library/sys.monitoring.rst:2 msgid ":mod:`!sys.monitoring` --- Execution event monitoring" -msgstr "" +msgstr ":mod:`!sys.monitoring` --- 執行事件監控" #: ../../library/sys.monitoring.rst:13 msgid "" @@ -26,12 +26,15 @@ msgid "" "independent module, so there is no need to ``import sys.monitoring``, simply " "``import sys`` and then use ``sys.monitoring``." msgstr "" +":mod:`sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" +"組,所以不需要 ``import sys.monitoring``,只需 ``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 "" +msgstr "此命名空間提供對啟動和控制事件監控所需的函式和常數的存取。" #: ../../library/sys.monitoring.rst:22 msgid "" @@ -39,18 +42,20 @@ msgid "" "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 "" +msgstr "監控 API 由三個元件組成:" #: ../../library/sys.monitoring.rst:28 msgid "`Tool identifiers`_" -msgstr "`Tool identifiers`_" +msgstr "`工具識別器 `_" #: ../../library/sys.monitoring.rst:29 msgid "`Events`_" -msgstr "`Events`_" +msgstr "`事件 `_" #: ../../library/sys.monitoring.rst:30 msgid ":ref:`Callbacks `" @@ -58,7 +63,7 @@ msgstr ":ref:`回呼 (callbacks) `" #: ../../library/sys.monitoring.rst:33 msgid "Tool identifiers" -msgstr "" +msgstr "工具識別器" #: ../../library/sys.monitoring.rst:35 msgid "" @@ -68,26 +73,31 @@ msgid "" "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 "" +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 "Should be called once a tool no longer requires *tool_id*." -msgstr "" +msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。" #: ../../library/sys.monitoring.rst:59 msgid "" @@ -96,18 +106,24 @@ msgid "" "only intended to be used to notify the VM that the particular *tool_id* is " "no longer in use." msgstr "" +":func:`free_tool_id` 不會停用與 *tool_id* 相關的全域或區域事件,也不會取消註" +"冊任何回呼函式。這個函式只是用來通知虛擬機器不再使用特定的 *tool_id*。" #: ../../library/sys.monitoring.rst:66 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:70 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 "" +"對於事件,VM 對所有 ID 的處理都是相同的,但預先定義了以下 ID,以使工具間的協" +"作更容易:" #: ../../library/sys.monitoring.rst:73 msgid "" @@ -127,99 +143,105 @@ msgstr "事件" #: ../../library/sys.monitoring.rst:82 msgid "The following events are supported:" -msgstr "" +msgstr "支援以下事件:" #: ../../library/sys.monitoring.rst:86 msgid "A conditional branch is taken (or not)." -msgstr "" +msgstr "採取(或不採取)一個條件分支。" #: ../../library/sys.monitoring.rst:90 msgid "A call in Python code (event occurs before the call)." -msgstr "" +msgstr "Python 程式碼中的呼叫(事件發生在呼叫之前)。" #: ../../library/sys.monitoring.rst:94 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." -msgstr "" +msgstr "從任何可呼叫物件引發的例外,除 Python 函式外(在退出後發生的事件)。" #: ../../library/sys.monitoring.rst:98 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." -msgstr "" +msgstr "從任何可呼叫函式回傳,除 Python 函式外(在回傳後發生的事件)。" #: ../../library/sys.monitoring.rst:102 msgid "An exception is handled." -msgstr "" +msgstr "一個例外被處理。" #: ../../library/sys.monitoring.rst:106 msgid "A VM instruction is about to be executed." -msgstr "" +msgstr "即將被執行的 VM 指令。" #: ../../library/sys.monitoring.rst:110 msgid "An unconditional jump in the control flow graph is made." -msgstr "" +msgstr "在控制流程圖中進行無條件跳轉。" #: ../../library/sys.monitoring.rst:114 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." -msgstr "" +msgstr "即將執行的指令與前一條指令的列號不同。" #: ../../library/sys.monitoring.rst:118 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." -msgstr "" +msgstr "Python 函式的繼續執行(對於產生器和協程函式),除了 ``throw()`` 呼叫。" #: ../../library/sys.monitoring.rst:122 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:126 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" -msgstr "" +msgstr "Python 函式的開始(在呼叫後立即發生,被呼叫者的 frame 將位於堆疊上)" #: ../../library/sys.monitoring.rst:130 msgid "A Python function is resumed by a ``throw()`` call." -msgstr "" +msgstr "Python 函式透過 ``throw()`` 呼叫來繼續。" #: ../../library/sys.monitoring.rst:134 msgid "Exit from a Python function during exception unwinding." -msgstr "" +msgstr "在例外展開 (unwind) 期間從 Python 函式退出。" #: ../../library/sys.monitoring.rst:138 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:142 msgid "" "An exception is raised, except those that cause a :monitoring-event:" "`STOP_ITERATION` event." msgstr "" +"例外會被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。" #: ../../library/sys.monitoring.rst:146 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." -msgstr "" +msgstr "例外會被重新引發 (re-raise),例如在 :keyword:`finally` 區塊的最後。" #: ../../library/sys.monitoring.rst:150 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." msgstr "" +"一個人為的 :exc:`StopIteration` 被引發;請參閱 `STOP_ITERATION 事件 `_。" #: ../../library/sys.monitoring.rst:153 msgid "More events may be added in the future." -msgstr "" +msgstr "將來可能會新增更多事件。" #: ../../library/sys.monitoring.rst:155 msgid "" @@ -229,10 +251,14 @@ msgid "" "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:163 msgid "An alias for ``0`` so users can do explicit comparisons like::" -msgstr "" +msgstr "``0`` 的別名,以便使用者可以進行明確比較,例如: ::" #: ../../library/sys.monitoring.rst:165 msgid "" @@ -244,11 +270,11 @@ msgstr "" #: ../../library/sys.monitoring.rst:168 msgid "Events are divided into three groups:" -msgstr "" +msgstr "事件被分為三組:" #: ../../library/sys.monitoring.rst:171 msgid "Local events" -msgstr "" +msgstr "區域事件" #: ../../library/sys.monitoring.rst:173 msgid "" @@ -256,6 +282,8 @@ msgid "" "at clearly defined locations. All local events can be disabled. The local " "events are:" msgstr "" +"區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" +"用。區域事件有:" #: ../../library/sys.monitoring.rst:177 msgid ":monitoring-event:`PY_START`" @@ -299,13 +327,13 @@ msgstr ":monitoring-event:`STOP_ITERATION`" #: ../../library/sys.monitoring.rst:189 msgid "Ancillary events" -msgstr "輔助事件" +msgstr "附屬事件 (ancillary events)" #: ../../library/sys.monitoring.rst:191 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" -msgstr "" +msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" #: ../../library/sys.monitoring.rst:194 msgid ":monitoring-event:`C_RAISE`" @@ -322,6 +350,10 @@ msgid "" "`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:203 msgid "Other events" @@ -331,11 +363,11 @@ msgstr "其他事件" msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." -msgstr "" +msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" #: ../../library/sys.monitoring.rst:208 msgid "The other events that can be monitored are:" -msgstr "" +msgstr "其他可以監控的事件有:" #: ../../library/sys.monitoring.rst:210 msgid ":monitoring-event:`PY_THROW`" @@ -355,7 +387,7 @@ msgstr ":monitoring-event:`EXCEPTION_HANDLED`" #: ../../library/sys.monitoring.rst:217 msgid "The STOP_ITERATION event" -msgstr "" +msgstr "STOP_ITERATION 事件" #: ../../library/sys.monitoring.rst:219 msgid "" @@ -365,6 +397,10 @@ msgid "" "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:225 msgid "" @@ -373,10 +409,13 @@ msgid "" "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:231 msgid "Turning events on and off" -msgstr "" +msgstr "開啟和關閉事件" #: ../../library/sys.monitoring.rst:233 msgid "" @@ -384,34 +423,38 @@ msgid "" "callback must be registered. Events can be turned on or off by setting the " "events either globally or for a particular code object." msgstr "" +"為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" +"特定程式碼物件來開啟或關閉事件。" #: ../../library/sys.monitoring.rst:240 msgid "Setting events globally" -msgstr "" +msgstr "全域設定事件" #: ../../library/sys.monitoring.rst:242 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." -msgstr "" +msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" #: ../../library/sys.monitoring.rst:246 msgid "Returns the ``int`` representing all the active events." -msgstr "" +msgstr "回傳代表所有有效事件的 ``int``。" #: ../../library/sys.monitoring.rst:250 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:253 msgid "No events are active by default." -msgstr "" +msgstr "預設沒有有效事件。" #: ../../library/sys.monitoring.rst:256 msgid "Per code object events" -msgstr "" +msgstr "每個程式碼物件事件" #: ../../library/sys.monitoring.rst:258 msgid "" @@ -420,32 +463,39 @@ msgid "" "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:265 msgid "Returns all the local events for *code*" -msgstr "" +msgstr "回傳 *code* 的所有區域事件" #: ../../library/sys.monitoring.rst:269 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." msgstr "" +"啟動 *event_set* 中設定 *code* 的所有區域事件。如果 *tool_id* 並未正在被使" +"用,則引發 :exc:`ValueError`。" #: ../../library/sys.monitoring.rst:272 msgid "" "Local events add to global events, but do not mask them. In other words, all " "global events will trigger for a code object, regardless of the local events." msgstr "" +"區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" +"全域事件都將為程式碼物件觸發。" #: ../../library/sys.monitoring.rst:278 msgid "Disabling events" -msgstr "停用事件" +msgstr "禁用事件" #: ../../library/sys.monitoring.rst:282 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." -msgstr "" +msgstr "可以從回呼函式回傳的特殊值,以停用當前程式碼位置的事件。" #: ../../library/sys.monitoring.rst:285 msgid "" @@ -453,6 +503,8 @@ msgid "" "`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` 來停用特定程式碼位置的區域" +"事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" #: ../../library/sys.monitoring.rst:289 msgid "" @@ -461,12 +513,14 @@ msgid "" "with no overhead if the debugger disables all monitoring except for a few " "breakpoints." msgstr "" +"停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" +"可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" #: ../../library/sys.monitoring.rst:296 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." -msgstr "" +msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" #: ../../library/sys.monitoring.rst:303 msgid "Registering callback functions" @@ -474,11 +528,11 @@ msgstr "註冊回呼函式" #: ../../library/sys.monitoring.rst:305 msgid "To register a callable for events call" -msgstr "" +msgstr "註冊事件呼叫的可呼叫物件" #: ../../library/sys.monitoring.rst:309 msgid "Registers the callable *func* for the *event* with the given *tool_id*" -msgstr "" +msgstr "使用給定的 *tool_id* 來註冊 *event* 的可呼叫物件 *func*" #: ../../library/sys.monitoring.rst:311 msgid "" @@ -486,22 +540,26 @@ msgid "" "is unregistered and returned. Otherwise :func:`register_callback` returns " "``None``." msgstr "" +"如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" +"則 :func:`register_callback` 會回傳 ``None``。" #: ../../library/sys.monitoring.rst:316 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:319 msgid "Callback functions can be registered and unregistered at any time." -msgstr "" +msgstr "回呼函式可以隨時被註冊和註銷。" #: ../../library/sys.monitoring.rst:321 msgid "" "Registering or unregistering a callback function will generate a :func:`sys." "audit` event." -msgstr "" +msgstr "註冊或註銷回呼函式將產生 :func:`sys.audit` 事件。" #: ../../library/sys.monitoring.rst:325 msgid "Callback function arguments" @@ -511,7 +569,7 @@ msgstr "回呼函式引數" msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." -msgstr "" +msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" #: ../../library/sys.monitoring.rst:332 msgid "" @@ -519,6 +577,8 @@ msgid "" "Different events will provide the callback function with different " "arguments, as follows:" msgstr "" +"當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" +"引數,如下所示:" #: ../../library/sys.monitoring.rst:335 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" @@ -559,7 +619,7 @@ msgstr "" #: ../../library/sys.monitoring.rst:347 msgid "" "If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." -msgstr "" +msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" #: ../../library/sys.monitoring.rst:349 msgid "" @@ -605,6 +665,8 @@ msgid "" "an untaken branch this will be the offset of the instruction following the " "branch." msgstr "" +"請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" +"將是該分支之後的指令的偏移量。" #: ../../library/sys.monitoring.rst:366 msgid ":monitoring-event:`INSTRUCTION`::"