@@ -30,22 +30,25 @@ msgid ""
3030"called or the main module's execution completes) or, more generally, upon :"
3131"term:`interpreter shutdown`."
3232msgstr ""
33+ ":mod:`!atexit` 模組定義了用於註冊和註銷\\ :dfn:`退出處理函式`\\ 的函式:這些"
34+ "函式會在「退出時」自動執行,也就是在程式正常終止時(例如呼叫 :func:`sys."
35+ "exit` 或主模組執行完成時),或更廣義地說,在\\ :term:`直譯器關閉 "
36+ "<interpreter shutdown>`\\ 時。"
3337
3438#: ../../library/atexit.rst:18
35- #, fuzzy
3639msgid ""
3740"At exit, all registered exit handlers are called in the *reverse* order in "
3841"which they were registered. If you register ``A``, ``B``, and ``C``, at "
3942"interpreter shutdown time they will be run in the order ``C``, ``B``, ``A``. "
4043"The assumption is that lower level modules will normally be imported before "
4144"higher level modules and thus must be cleaned up later."
4245msgstr ""
43- "在程式正常終止時(例如呼叫 :func:`sys.exit` 或主要模組執行完成),所有已註冊"
44- "函式都會依照後進先出的順序呼叫。這邊做的假設是較低階的模組通常會在較高階模組"
45- "之前被引入,因此較低階模組必須在比較後面才被清理。"
46+ "退出時,所有已註冊的退出處理函式都會按照註冊順序的\\ *反序*\\ 被呼叫。如果你"
47+ "註冊了 ``A``、``B`` 和 ``C``,則在直譯器關閉時,它們會按照 ``C``、``B``、"
48+ "``A`` 的順序執行。這邊做的假設是較低階的模組通常會在較高階模組之前被引入,因"
49+ "此較低階模組必須在比較後面才被清理。"
4650
4751#: ../../library/atexit.rst:25
48- #, fuzzy
4952msgid ""
5053"If an exception is raised during execution of an exit handler, a traceback "
5154"is printed (unless :exc:`SystemExit` is raised) and the exception "
@@ -64,16 +67,19 @@ msgid ""
6467"C API :c:func:`Py_EndInterpreter`). Registration functions in this module "
6568"only affect the interpreter they are called from."
6669msgstr ""
70+ "在使用多個直譯器的程式中,每個直譯器都有自己的退出處理函式堆疊,這些函式會在"
71+ "該直譯器關閉時執行(例如透過 :meth:`concurrent.interpreters.Interpreter."
72+ "close` 或 C API :c:func:`Py_EndInterpreter`)。此模組中的註冊函式只會影響呼叫"
73+ "它們的那個直譯器。"
6774
6875#: ../../library/atexit.rst:37
69- #, fuzzy
7076msgid ""
7177"**Note:** Exit handlers are not called when the program is killed by a "
7278"signal not handled by Python, when a Python fatal internal error is "
7379"detected, or when :func:`os._exit` is called."
7480msgstr ""
75- "**注意:**\\ 當程式被一個不是來自 Python 的訊號終止、偵測到有 Python 嚴重內部 "
76- "錯誤時或者 :func:`os._exit` 被呼叫時,透過此模組註冊的函式就不會被呼叫 。"
81+ "**注意:**\\ 當程式被一個 Python 未處理的訊號終止、偵測到 Python 發生嚴重內部 "
82+ "錯誤,或者 :func:`os._exit` 被呼叫時,退出處理函式就不會被呼叫 。"
7783
7884#: ../../library/atexit.rst:41
7985msgid ""
@@ -87,39 +93,39 @@ msgid ""
8793"that other exit handlers may still run arbitrary Python code after you clean "
8894"up. Such code should succeed or fail with an exception, rather than crash."
8995msgstr ""
96+ "在撰寫退出處理函式時,特別是在 C API 擴充套件中,請記住其他退出處理函式可能會"
97+ "在你清理完成之後,仍然執行任意的 Python 程式碼。這樣的程式碼應該成功執行或以"
98+ "例外表示失敗,而不是造成崩潰 (crash)。"
9099
91100#: ../../library/atexit.rst:50
92- #, fuzzy
93101msgid ""
94102"Attempts to start a new thread or :func:`os.fork` a new process in an exit "
95103"handler now leads to :exc:`RuntimeError`. Previously, this could cause race "
96104"conditions between the main Python runtime thread freeing thread states "
97105"while internal :mod:`threading` routines or the new process try to use that "
98106"state, which could lead to crashes rather than clean shutdown."
99107msgstr ""
100- "啟動新執行緒或從已註冊函式呼叫 :func:`os.fork` 可能會導致 Python 主要 "
101- "runtime 執行緒釋放執行緒狀態,而內部 :mod:`threading` 例程或新行程嘗試使用該 "
102- "狀態所形成的競態條件 (race condition)。這可能會導致崩潰 (crash) 而不是完整關 "
103- "閉中止 。"
108+ "在退出處理函式中嘗試啟動新執行緒或以 :func:`os.fork` 建立新行程,現在會導致 "
109+ "\\ :exc:`RuntimeError`。在此之前,這可能會在 Python 主要 runtime 執行緒釋放執 "
110+ "行緒狀態的同時,內部 :mod:`threading` 例程或新行程嘗試使用該狀態,兩者間形成 "
111+ "競態條件 (race condition),進而導致崩潰 (crash) 而非乾淨的關閉 。"
104112
105113#: ../../library/atexit.rst:58
106- #, fuzzy
107114msgid ""
108115"When used with subinterpreters, registered functions are local to the "
109116"interpreter they were registered in."
110117msgstr ""
111- "當與 C-API 子直譯器 (subinterpreter) 一起使用時,已註冊函式對於它們所註冊的直 "
112- "譯器來說是區域的 (local)。"
118+ "當與子直譯器 (subinterpreter) 一起使用時,已註冊函式對於它們所註冊的直譯器來 "
119+ "說是區域的 (local)。"
113120
114121#: ../../library/atexit.rst:64
115- #, fuzzy
116122msgid ""
117123"Register *func* as an exit handler. Any optional arguments that are to be "
118124"passed to *func* must be passed as arguments to :func:`register`. It is "
119125"possible to register the same function and arguments more than once."
120126msgstr ""
121- "將 *func* 註冊為要在終止時執行的函式 。任何要傳遞給 *func* 的可選引數都必須作 "
122- "為引數傳遞給 :func:`register`。可以多次註冊相同的函式和引數。"
127+ "將 *func* 註冊為一個退出處理函式 。任何要傳遞給 *func* 的可選引數都必須作為引 "
128+ "數傳遞給 :func:`register`。可以多次註冊相同的函式和引數。"
123129
124130#: ../../library/atexit.rst:69
125131msgid ""
@@ -128,7 +134,6 @@ msgid ""
128134msgstr "該函式回傳 *func*,這使得可以將其作為裝飾器使用。"
129135
130136#: ../../library/atexit.rst:74
131- #, fuzzy
132137msgid ""
133138"Remove *func* from the list of exit handlers. :func:`unregister` silently "
134139"does nothing if *func* was not previously registered. If *func* has been "
@@ -137,10 +142,10 @@ msgid ""
137142"internally during unregistration, so function references do not need to have "
138143"matching identities."
139144msgstr ""
140- "從在直譯器中止時會執行之函式串列中刪除 *func*。如果 *func* 先前未被註冊,則 :"
141- "func: `unregister` 不會執行任何操作。如果 *func* 已被註冊多次,則該函式在 :"
142- "mod:`! atexit` 呼叫堆疊 (call stack) 中的所有存在都會被刪除。會在註銷期間於內 "
143- "部使用相等性比較 (``==``),因此函式參照不需要具有匹配的識別性。"
145+ "從退出處理函式串列中移除 *func*。如果 *func* 先前未被註冊,則 :func :"
146+ "`unregister` 不會執行任何操作。如果 *func* 已被註冊多次,則該函式在 :mod:`! "
147+ "atexit` 呼叫堆疊 (call stack) 中的所有存在都會被刪除。會在註銷期間於內部使用 "
148+ "相等性比較 (``==``),因此函式參照不需要具有匹配的識別性。"
144149
145150#: ../../library/atexit.rst:84
146151msgid "Module :mod:`readline`"
0 commit comments