@@ -1,16 +1,16 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Matt Wang <mattwang44@gmail.com>, 2024 #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-11 17:13+0000\n" "PO-Revision-Date:YEAR-MO-DA HO:MI+ZONE \n" "Last-Translator:FULL NAME <EMAIL@ADDRESS >\n" "PO-Revision-Date:2024-05-03 02:14+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" Expand All @@ -20,7 +20,7 @@ msgstr "" #: ../../library/devmode.rst:4 msgid "Python Development Mode" msgstr "" msgstr "Python 開發模式 " #: ../../library/devmode.rst:8 msgid "" Expand All @@ -29,36 +29,42 @@ msgid "" "the default if the code is correct; new warnings are only emitted when an " "issue is detected." msgstr "" "Python 開發模式引入了額外的 runtime 檢查,預設啟用這些檢查的成本太高。如果程" "式碼正確,它不應比預設值更詳細;僅當偵測到問題時才會發出新警告。" #: ../../library/devmode.rst:13 msgid "" "It can be enabled using the :option:`-X dev <-X>` command line option or by " "setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``." msgstr "" "可以使用 :option:`-X dev <-X>` 命令列選項或將 :envvar:`PYTHONDEVMODE` 環境變" "數設為 1 來啟用它。" #: ../../library/devmode.rst:16 msgid "See also :ref:`Python debug build <debug-build>`." msgstr "" msgstr "另請參閱 :ref:`Python 除錯建置 <debug-build>`。 " #: ../../library/devmode.rst:19 msgid "Effects of the Python Development Mode" msgstr "" msgstr "Python 開發模式的影響 " #: ../../library/devmode.rst:21 msgid "" "Enabling the Python Development Mode is similar to the following command, " "but with additional effects described below::" msgstr "" msgstr "啟用 Python 開發模式類似以下指令,但具有如下所述的附加效果: " #: ../../library/devmode.rst:26 msgid "Effects of the Python Development Mode:" msgstr "" msgstr "Python 開發模式的效果: " #: ../../library/devmode.rst:28 msgid "" "Add ``default`` :ref:`warning filter <describing-warning-filters>`. The " "following warnings are shown:" msgstr "" "新增 ``default`` :ref:`警告過濾器 <describing-warning-filters>`。以下警告會被" "顯示:" #: ../../library/devmode.rst:31 msgid ":exc:`DeprecationWarning`" Expand All @@ -81,55 +87,61 @@ msgid "" "Normally, the above warnings are filtered by the default :ref:`warning " "filters <describing-warning-filters>`." msgstr "" "一般來說,上述警告會被預設的\\ :ref:`警告過濾器 <describing-warning-" "filters>`\\ 給過濾掉。" #: ../../library/devmode.rst:39 msgid "" "It behaves as if the :option:`-W default <-W>` command line option is used." msgstr "" msgstr "它的行為就像使用 :option:`-W default <-W>` 命令列選項一樣。 " #: ../../library/devmode.rst:41 msgid "" "Use the :option:`-W error <-W>` command line option or set the :envvar:" "`PYTHONWARNINGS` environment variable to ``error`` to treat warnings as " "errors." msgstr "" "使用 :option:`-W error <-W>` 命令列選項或將 :envvar:`PYTHONWARNINGS` 環境變數" "設為 ``error`` 會將警告視為錯誤。" #: ../../library/devmode.rst:45 msgid "Install debug hooks on memory allocators to check for:" msgstr "" msgstr "在記憶體分配器上安裝除錯 hook(掛鉤)以檢查: " #: ../../library/devmode.rst:47 msgid "Buffer underflow" msgstr "" msgstr "緩衝區下溢 (underflow) " #: ../../library/devmode.rst:48 msgid "Buffer overflow" msgstr "" msgstr "緩衝區溢位 (overflow) " #: ../../library/devmode.rst:49 msgid "Memory allocator API violation" msgstr "" msgstr "記憶體分配器 API 違規 " #: ../../library/devmode.rst:50 msgid "Unsafe usage of the GIL" msgstr "" msgstr "GIL 的不安全使用 " #: ../../library/devmode.rst:52 msgid "See the :c:func:`PyMem_SetupDebugHooks` C function." msgstr "" msgstr "請參閱 :c:func:`PyMem_SetupDebugHooks` C 函式。 " #: ../../library/devmode.rst:54 msgid "" "It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to " "``debug``." msgstr "" msgstr "它的行為就好像是將 :envvar:`PYTHONMALLOC` 環境變數設定為 ``debug`` 一樣。 " #: ../../library/devmode.rst:57 msgid "" "To enable the Python Development Mode without installing debug hooks on " "memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to " "``default``." msgstr "" "若要啟用 Python 開發模式而不在記憶體分配器上安裝偵錯 hook,請將 :envvar:" "`PYTHONMALLOC` 環境變數設為 ``default``。" #: ../../library/devmode.rst:61 msgid "" Expand All @@ -138,49 +150,62 @@ msgid "" "SIGABRT`, :const:`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to " "dump the Python traceback on a crash." msgstr "" "在 Python 啟動時呼叫 :func:`faulthandler.enable` 來為 :const:`~signal." "SIGSEGV`、:const:`~signal.SIGFPE`、:const:`~signal.SIGABRT`、:const:`~signal." "SIGBUS` 和 :const:`~signal.SIGILL` 訊號安裝處理函式以在當機時傾印 (dump) " "Python 回溯 (traceback)。" #: ../../library/devmode.rst:66 msgid "" "It behaves as if the :option:`-X faulthandler <-X>` command line option is " "used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to " "``1``." msgstr "" "它的行為就像使用 :option:`-X faulthandler <-X>` 命令列選項或將 :envvar:" "`PYTHONFAULTHANDLER` 環境變數設定為 ``1``。" #: ../../library/devmode.rst:70 msgid "" "Enable :ref:`asyncio debug mode <asyncio-debug-mode>`. For example, :mod:" "`asyncio` checks for coroutines that were not awaited and logs them." msgstr "" "啟用 :ref:`asyncio 除錯模式 <asyncio-debug-mode>`。例如 :mod:`asyncio` 會檢查" "未被等待的 (not awaited) 協程並記錄 (log) 它們。" #: ../../library/devmode.rst:73 msgid "" "It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is " "set to ``1``." msgstr "" msgstr "它的行為就像將 :envvar:`PYTHONASYNCIODEBUG` 環境變數設定為 1 一樣。 " #: ../../library/devmode.rst:76 msgid "" "Check the *encoding* and *errors* arguments for string encoding and decoding " "operations. Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes." "decode`." msgstr "" "檢查字串編碼和解碼操作的 *encoding* 和 *errors* 引數。例如::func:`open`、:" "meth:`str.encode` 和 :meth:`bytes.decode`。" #: ../../library/devmode.rst:80 msgid "" "By default, for best performance, the *errors* argument is only checked at " "the first encoding/decoding error and the *encoding* argument is sometimes " "ignored for empty strings." msgstr "" "預設情況下,為了獲得最佳效能,僅在第一個編碼/解碼錯誤時檢查 *errors* 引數,並" "且有時會因為是空字串而忽略 *encoding* 引數。" #: ../../library/devmode.rst:84 msgid "The :class:`io.IOBase` destructor logs ``close()`` exceptions." msgstr "" msgstr ":class:`io.IOBase` 解構函式會記錄 ``close()`` 例外。 " #: ../../library/devmode.rst:85 msgid "" "Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to " "``True``." msgstr "" "將 :data:`sys.flags` 的 :attr:`~sys.flags.dev_mode` 屬性設為 ``True``。" #: ../../library/devmode.rst:88 msgid "" Expand All @@ -192,29 +217,37 @@ msgid "" "buffer overflow error logs the traceback where the memory block was " "allocated." msgstr "" "Python 開發模式預設不會啟用 :mod:`tracemalloc` 模組,因為(效能和記憶體的)開" "銷太大。啟用 :mod:`tracemalloc` 模組可提供有關某些錯誤來源的附加資訊。例如 :" "exc:`ResourceWarning` 記錄了分配資源之處的回溯、緩衝區溢位錯誤記錄了分配記憶" "體區塊的回溯。" #: ../../library/devmode.rst:95 msgid "" "The Python Development Mode does not prevent the :option:`-O` command line " "option from removing :keyword:`assert` statements nor from setting :const:" "`__debug__` to ``False``." msgstr "" "Python 開發模式不會防止 :option:`-O` 命令列選項刪除 :keyword:`assert` 陳述" "式,也不會防止將 :const:`__debug__` 設定為 ``False``。" #: ../../library/devmode.rst:99 msgid "" "The Python Development Mode can only be enabled at the Python startup. Its " "value can be read from :data:`sys.flags.dev_mode <sys.flags>`." msgstr "" "Python 開發模式只能在 Python 啟動時啟用。它的值可以從 :data:`sys.flags." "dev_mode <sys.flags>` 讀取。" #: ../../library/devmode.rst:102 msgid "The :class:`io.IOBase` destructor now logs ``close()`` exceptions." msgstr "" msgstr ":class:`io.IOBase` 解構函式現在會記錄 ``close()`` 例外。 " #: ../../library/devmode.rst:105 msgid "" "The *encoding* and *errors* arguments are now checked for string encoding " "and decoding operations." msgstr "" msgstr "現在會為字串編碼和解碼操作檢查 *encoding* 和 *errors* 引數。 " #: ../../library/devmode.rst:111 msgid "ResourceWarning Example" Expand All @@ -224,30 +257,32 @@ msgstr "ResourceWarning 範例" msgid "" "Example of a script counting the number of lines of the text file specified " "in the command line::" msgstr "" msgstr "計算命令列中指定的文字檔案列數的腳本範例: :: " #: ../../library/devmode.rst:127 msgid "" "The script does not close the file explicitly. By default, Python does not " "emit any warning. Example using README.txt, which has 269 lines:" msgstr "" "該腳本不會明確關閉檔案。預設情況下,Python 不會發出任何警告。使用 README.txt " "的範例,該檔案有 269 列:" #: ../../library/devmode.rst:135 msgid "" "Enabling the Python Development Mode displays a :exc:`ResourceWarning` " "warning:" msgstr "" msgstr "啟用 Python 開發模式會顯示 :exc:`ResourceWarning` 警告: " #: ../../library/devmode.rst:145 msgid "" "In addition, enabling :mod:`tracemalloc` shows the line where the file was " "opened:" msgstr "" msgstr "此外,啟用 :mod:`tracemalloc` 會顯示檔案被開啟的那一列: " #: ../../library/devmode.rst:160 msgid "" "The fix is to close explicitly the file. Example using a context manager::" msgstr "" msgstr "修復方法是明確關閉該檔案。以下是使用情境管理器的範例: :: " #: ../../library/devmode.rst:168 msgid "" Expand All @@ -256,24 +291,29 @@ msgid "" "CPython, but it is even worse in PyPy. Closing resources explicitly makes an " "application more deterministic and more reliable." msgstr "" "不明確關閉資源可能會使資源開啟的時間比預期的長得多;它可能會在退出 Python 時" "導致嚴重問題。在 CPython 中很糟糕,但在 PyPy 中更糟。明確關閉資源使應用程式更" "具確定性和可靠性。" #: ../../library/devmode.rst:175 msgid "Bad file descriptor error example" msgstr "" msgstr "檔案描述器的錯誤範例 " #: ../../library/devmode.rst:177 msgid "Script displaying the first line of itself::" msgstr "" msgstr "顯示自身第一列的腳本: :: " #: ../../library/devmode.rst:190 msgid "By default, Python does not emit any warning:" msgstr "" msgstr "預設情況下,Python 不會發出任何警告: " #: ../../library/devmode.rst:197 msgid "" "The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad " "file descriptor\" error when finalizing the file object:" msgstr "" "Python 開發模式在最終化 (finalize) 檔案物件時顯示 :exc:`ResourceWarning` 並記" "錄 \"Bad file descriptor\" 錯誤:" #: ../../library/devmode.rst:213 msgid "" Expand All @@ -283,9 +323,15 @@ msgid "" "worst case scenario, closing it twice can lead to a crash (see :issue:" "`18748` for an example)." msgstr "" "``os.close(fp.fileno())`` 會關閉檔案描述器。當檔案物件最終化函式 (finalizer) 嘗" "試再次關閉檔案描述器時,它會失敗並出現 ``Bad file descriptor`` 錯誤。檔案描述" "器只能關閉一次。在最壞的情況下,將它關閉兩次可能會導致崩潰 (crash)(相關範例" "請參閱 :issue:`18748`)。" #: ../../library/devmode.rst:219 msgid "" "The fix is to remove the ``os.close(fp.fileno())`` line, or open the file " "with ``closefd=False``." msgstr "" "修復方法是刪除 ``os.close(fp.fileno())`` 那列,或使用 ``closefd=False`` 開啟" "檔案。"