diff --git a/library/sys.po b/library/sys.po index 4a3bf4a219..b5b0d398a2 100644 --- a/library/sys.po +++ b/library/sys.po @@ -30,18 +30,21 @@ msgid "" "is always available. Unless explicitly noted otherwise, all variables are " "read-only." msgstr "" +"此模組提供存取一些由直譯器使用或維護的變數,以及與直譯器強烈互動的函式。它總是可用的。除非明確說明,否則所有變數都是唯讀的。" #: ../../library/sys.rst:16 msgid "" "On POSIX systems where Python was built with the standard ``configure`` " "script, this contains the ABI flags as specified by :pep:`3149`." msgstr "" +"在使用標準 ``configure`` 指令碼建置 Python 的 POSIX 系統上,這包含 :pep:`3149` 中規定的 ABI 旗標。" #: ../../library/sys.rst:21 msgid "" "Default flags became an empty string (``m`` flag for pymalloc has been " "removed)." msgstr "" +"預設旗標變成空字串(pymalloc 的 ``m`` 旗標已被移除)。" #: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 #: ../../library/sys.rst:760 ../../library/sys.rst:778 @@ -57,6 +60,7 @@ msgid "" "Append the callable *hook* to the list of active auditing hooks for the " "current (sub)interpreter." msgstr "" +"將可呼叫的 *hook* 附加到目前(子)直譯器的活躍稽核 hook 清單中。" #: ../../library/sys.rst:33 msgid "" @@ -67,6 +71,7 @@ msgid "" "Hooks can then log the event, raise an exception to abort the operation, or " "terminate the process entirely." msgstr "" +"當稽核事件透過 :func:`sys.audit` 函式引發時,每個 hook 都會按照其新增的順序被呼叫,並傳入事件名稱和引數元組。由 :c:func:`PySys_AddAuditHook` 新增的原生 hook 會先被呼叫,接著是在目前(子)直譯器中新增的 hook。Hook 可以記錄事件、引發例外以中止操作,或完全終止程序。" #: ../../library/sys.rst:40 msgid "" @@ -79,6 +84,7 @@ msgid "" "runtime, and any modules allowing arbitrary memory modification (such as :" "mod:`ctypes`) should be completely removed or closely monitored." msgstr "" +"請注意稽核 hook 主要是用來收集關於內部或其他無法觀察的操作的資訊,無論是由 Python 或以 Python 撰寫的函式庫執行的。它們不適合用來實作「沙盒」。特別是,惡意程式碼可以輕易地停用或繞過使用此函式新增的 hook。至少,任何安全敏感的 hook 必須在初始化執行時期之前使用 C API :c:func:`PySys_AddAuditHook` 新增,而任何允許任意記憶體修改的模組(例如 :mod:`ctypes`)應該被完全移除或密切監控。" #: ../../library/sys.rst:49 ../../library/sys.rst:51 msgid "" @@ -88,10 +94,9 @@ msgid "" "and the exception suppressed. As a result, callers cannot assume that their " "hook has been added unless they control all existing hooks." msgstr "" -"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 ``sys." -"addaudithook`` 的稽核事件。如果任何現有的 hook 引發從 :class:`RuntimeError` " -"衍生的例外,則不會添加新的 hook 並抑制異常。因此,除非呼叫者控制所有已存在的 " -"hook,他們不能假設他們的 hook 已被添加。" +"呼叫 :func:`sys.addaudithook` 本身會引發一個不帶任何引數、名為 ``sys.addaudithook`` " +"的稽核事件。如果任何現有的 hook 引發從 :class:`RuntimeError` 衍生的例外,則不會添加新的 hook " +"並抑制例外。因此,除非呼叫者控制所有已存在的 hook,他們不能假設他們的 hook 已被添加。" #: ../../library/sys.rst:58 msgid "" @@ -106,6 +111,7 @@ msgid "" "Exceptions derived from :class:`Exception` but not :class:`RuntimeError` are " "no longer suppressed." msgstr "" +"衍生自 :class:`Exception` 但非 :class:`RuntimeError` 的例外不再被抑制。" #: ../../library/sys.rst:70 msgid "" @@ -113,6 +119,7 @@ msgid "" "if the callable has a ``__cantrace__`` member that is set to a true value. " "Otherwise, trace functions will skip the hook." msgstr "" +"當追蹤功能啟用時(參閱 :func:`settrace`),Python hook 只有在可呼叫物件具有設定為真值的 ``__cantrace__`` 成員時才會被追蹤。否則,追蹤函式會跳過該 hook。" #: ../../library/sys.rst:77 msgid "" @@ -123,6 +130,7 @@ msgid "" "c'``. If no script name was passed to the Python interpreter, ``argv[0]`` " "is the empty string." msgstr "" +"傳遞給 Python 指令碼的命令列引數清單。``argv[0]`` 是指令碼名稱(這是否為完整路徑取決於作業系統)。如果命令是使用直譯器的 :option:`-c` 命令列選項執行的,``argv[0]`` 會被設定為字串 ``'-c'``。如果沒有將指令碼名稱傳遞給 Python 直譯器,``argv[0]`` 是空字串。" #: ../../library/sys.rst:83 msgid "" @@ -141,6 +149,7 @@ msgid "" "you need original bytes, you can get it by ``[os.fsencode(arg) for arg in " "sys.argv]``." msgstr "" +"在 Unix 上,命令列引數會以位元組形式從作業系統傳遞。Python 使用檔案系統編碼和 \"surrogateescape\" 錯誤處理器來解碼它們。當你需要原始位元組時,可以透過 ``[os.fsencode(arg) for arg in sys.argv]`` 來取得。" #: ../../library/sys.rst:101 msgid "" @@ -150,6 +159,7 @@ msgid "" "given event are considered a public and stable API and should not be " "modified between releases." msgstr "" +"引發一個稽核事件並觸發任何活躍的稽核 hook。*event* 是識別事件的字串,*args* 可能包含關於該事件更多資訊的選擇性引數。給定事件的引數數量和型別被視為公開且穩定的 API,不應在版本之間修改。" #: ../../library/sys.rst:107 msgid "" @@ -310,8 +320,7 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"_current_exceptions``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys._current_exceptions``。" #: ../../library/sys.rst:240 msgid "" @@ -459,8 +468,7 @@ msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." msgstr "" -"運行環境字串,例如瀏覽器使用者代理 (browser user agent) ``'Node.js " -"v14.18.2'`` 或 ``'UNKNOWN'``。" +"運行環境字串,例如瀏覽器使用者代理(browser user agent) ``'Node.js v14.18.2'`` 或 ``'UNKNOWN'``。" #: ../../library/sys.rst:363 msgid "``True`` if Python is compiled with Emscripten pthreads support." @@ -614,6 +622,7 @@ msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" +"引發 :exc:`SystemExit` 例外,表示意圖退出直譯器。" #: ../../library/sys.rst:504 msgid "" @@ -630,6 +639,7 @@ msgid "" "code of 1. In particular, ``sys.exit(\"some error message\")`` is a quick " "way to exit a program when an error occurs." msgstr "" +"選擇性引數 *arg* 可以是給出退出狀態的整數(預設為零),或其他型別的物件。如果它是整數,零被 shell 等視為「成功終止」,任何非零值被視為「異常終止」。大多數系統要求它在 0-127 範圍內,否則會產生未定義的結果。某些系統有將特定含義分配給特定退出代碼的慣例,但這些通常不太成熟;Unix 程式通常使用 2 來表示命令列語法錯誤,使用 1 來表示所有其他類型的錯誤。如果傳遞了其他型別的物件,``None`` 等同於傳遞零,任何其他物件會被列印到 :data:`stderr` 並導致退出代碼為 1。特別是,``sys.exit(\"some error message\")`` 是在發生錯誤時退出程式的快速方法。" #: ../../library/sys.rst:517 msgid "" @@ -639,6 +649,7 @@ msgid "" "statements are honored, and it is possible to intercept the exit attempt at " "an outer level." msgstr "" +"由於 :func:`exit` 最終「只是」引發例外,它只有在從主執行緒呼叫且例外未被攔截時才會退出程序。:keyword:`try` 陳述式的 finally 子句中指定的清理動作會被執行,並且可以在外層攔截退出嘗試。" #: ../../library/sys.rst:522 msgid "" @@ -1152,8 +1163,7 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." msgstr "" -"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys." -"_getframe``。" +"引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys._getframe``。" #: ../../library/sys.rst:903 ../../library/sys.rst:919 msgid "" @@ -1175,8 +1185,7 @@ msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." msgstr "" -"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." -"_getframemodulename``。" +"引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys._getframemodulename``。" #: ../../library/sys.rst:927 msgid "" @@ -1676,6 +1685,7 @@ msgid "" "user's program. Arguments consumed by the interpreter itself will be present " "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" +":data:`sys.orig_argv` 的元素是 Python 直譯器的引數,而 :data:`sys.argv` 的元素是使用者程式的引數。被直譯器本身消耗的引數會出現在 :data:`sys.orig_argv` 中,但在 :data:`sys.argv` 中會缺失。" #: ../../library/sys.rst:1366 msgid "" @@ -1683,6 +1693,7 @@ msgid "" "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" +"指定模組搜尋路徑的字串清單。從環境變數 :envvar:`PYTHONPATH` 初始化,加上依賴安裝的預設值。" #: ../../library/sys.rst:1370 msgid "" @@ -1690,29 +1701,34 @@ msgid "" "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" +"預設情況下,在程式啟動時初始化時,會將一個可能不安全的路徑前置到 :data:`sys.path` (在 :envvar:`PYTHONPATH` 產生的條目之前):" #: ../../library/sys.rst:1374 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" +"``python -m module`` 命令列:前置目前工作目錄。" #: ../../library/sys.rst:1376 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" +"``python script.py`` 命令列:前置指令碼的目錄。如果它是符號連結,則解析符號連結。" #: ../../library/sys.rst:1378 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" +"``python -c code`` 和 ``python`` (REPL)命令列:前置空字串,這表示目前工作目錄。" #: ../../library/sys.rst:1381 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" +"為了不前置這個可能不安全的路徑,請使用 :option:`-P` 命令列選項或 :envvar:`PYTHONSAFEPATH` 環境變數。" #: ../../library/sys.rst:1384 msgid "" @@ -1720,12 +1736,14 @@ msgid "" "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" +"程式可以自由地為自己的目的修改這個清單。只能將字串加入到 :data:`sys.path`;所有其他資料型別在匯入時會被忽略。" #: ../../library/sys.rst:1390 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" +"模組 :mod:`site` 這描述了如何使用 .pth 檔案來擴展 :data:`sys.path`。" #: ../../library/sys.rst:1395 msgid "" @@ -2237,16 +2255,14 @@ msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"set_asyncgen_hooks_firstiter``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.set_asyncgen_hooks_firstiter``。" #: ../../library/sys.rst:1724 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." -"set_asyncgen_hooks_finalizer``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.set_asyncgen_hooks_finalizer``。" #: ../../library/sys.rst:1726 msgid "" @@ -2619,12 +2635,14 @@ msgid "" "version information out of it, rather, use :data:`version_info` and the " "functions provided by the :mod:`platform` module." msgstr "" +"包含 Python 直譯器版本號碼以及建置號碼和所使用編譯器的額外資訊的字串。這個字串會在啟動互動式直譯器時顯示。不要從中擷取版本資訊,而是應使用 :data:`version_info` 和 :mod:`platform` 模組提供的函式。" #: ../../library/sys.rst:2016 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" +"此直譯器的 C API 版本。程式設計師在除錯 Python 和擴充模組之間的版本衝突時可能會發現這很有用。" #: ../../library/sys.rst:2022 msgid "" @@ -2636,6 +2654,7 @@ msgid "" "also be accessed by name, so ``sys.version_info[0]`` is equivalent to ``sys." "version_info.major`` and so on." msgstr "" +"包含版本號碼五個組成部分的元組:*major*、*minor*、*micro*、*releaselevel* 和 *serial*。除了 *releaselevel* 以外的所有值都是整數;發布級別是 ``'alpha'``、``'beta'``、``'candidate'`` 或 ``'final'``。對應於 Python 版本 2.0 的 ``version_info`` 值是 ``(2, 0, 0, 'final', 0)``。這些組成部分也可以透過名稱存取,所以 ``sys.version_info[0]`` 等同於 ``sys.version_info.major``,以此類推。" #: ../../library/sys.rst:2030 msgid "Added named component attributes."