@@ -388,9 +388,8 @@ msgid ""
388388msgstr ""
389389
390390#: ../../c-api/veryhigh.rst:347
391- #, fuzzy
392391msgid "Low-level flags"
393- msgstr "編譯器旗標。 "
392+ msgstr "低階旗標 "
394393
395394#: ../../c-api/veryhigh.rst:348
396395msgid ""
@@ -399,13 +398,17 @@ msgid ""
399398"reason to use them. They are considered implementation details and may "
400399"change at any time."
401400msgstr ""
401+ "以下的旗標和遮罩僅滿足標準函式庫和互動式直譯器的少數特定需求,標準函式庫以外"
402+ "的程式碼很少有理由使用它們。它們被視為實作細節,可能隨時變更。"
402403
403404#: ../../c-api/veryhigh.rst:355
404405msgid ""
405406"This flag is a private interface between the compiler and the :mod:`codeop` "
406407"module. Do not use it; its behavior is unsupported and may change without "
407408"warning."
408409msgstr ""
410+ "此旗標是編譯器與 :mod:`codeop` 模組之間的私有介面,請勿使用;其行為不受支援,"
411+ "且可能在沒有警告的情況下變更。"
409412
410413#: ../../c-api/veryhigh.rst:359
411414msgid ""
@@ -418,6 +421,12 @@ msgid ""
418421"with a real syntax error, so that interactive interpreters know when to "
419422"prompt for another line instead of reporting an error."
420423msgstr ""
424+ "設定此旗標後,當編譯因原始文字在預期需要更多輸入之處結束而失敗時(例如在縮排"
425+ "區塊中間或未結束的字串字面值中),所引發的錯誤會是未有文件記載的 "
426+ "``_IncompleteInputError``,它是 :exc:`SyntaxError` 的子類別。:mod:`codeop` 模"
427+ "組會設定此旗標,並搭配 :c:macro:`PyCF_DONT_IMPLY_DEDENT`,以區分不完整的輸入"
428+ "與帶有真正語法錯誤的輸入,讓互動式直譯器知道何時該提示輸入下一行,而不是回報"
429+ "錯誤。"
421430
422431#: ../../c-api/veryhigh.rst:373
423432msgid ""
@@ -427,6 +436,9 @@ msgid ""
427436"the source ends with a newline; otherwise, compilation fails with a :exc:"
428437"`SyntaxError`:"
429438msgstr ""
439+ "依預設,使用 :c:var:`Py_single_input` 起始符號進行編譯時,抵達原始文字結尾會"
440+ "隱式關閉所有開啟的縮排區塊。設定此旗標後,只有當原始碼的最後一行以換行符號結"
441+ "尾時,開啟的區塊才會被關閉;否則編譯會失敗並引發 :exc:`SyntaxError`:"
430442
431443#: ../../c-api/veryhigh.rst:379
432444msgid ""
@@ -445,6 +457,20 @@ msgid ""
445457"flags.cf_flags = PyCF_DONT_IMPLY_DEDENT;\n"
446458"Py_CompileStringFlags(source, \" <input>\" , Py_single_input, &flags);"
447459msgstr ""
460+ "PyCompilerFlags flags = {\n"
461+ " .cf_flags = 0,\n"
462+ " .cf_feature_version = PY_MINOR_VERSION,\n"
463+ "};\n"
464+ "const char *source = \" if a:\\ n pass\" ;\n"
465+ "\n"
466+ "/* 「if」區塊被隱式關閉;\n"
467+ " 這會回傳一個程式碼物件: */\n"
468+ "Py_CompileStringFlags(source, \" <input>\" , Py_single_input, &flags);\n"
469+ "\n"
470+ "/* 加上此旗標後,這會因為 SyntaxError 而失敗,\n"
471+ " 因為最後一行沒有以換行符號結尾: */\n"
472+ "flags.cf_flags = PyCF_DONT_IMPLY_DEDENT;\n"
473+ "Py_CompileStringFlags(source, \" <input>\" , Py_single_input, &flags);"
448474
449475#: ../../c-api/veryhigh.rst:396
450476msgid ""
@@ -453,12 +479,16 @@ msgid ""
453479"does not yet end with a newline, so it fails to compile and the user is "
454480"prompted for another line."
455481msgstr ""
482+ ":mod:`codeop` 模組使用此旗標來偵測不完整的互動式輸入。當使用者仍在縮排區塊內"
483+ "輸入時,原始碼尚未以換行符號結尾,因此編譯會失敗,並提示使用者輸入下一行。"
456484
457485#: ../../c-api/veryhigh.rst:403
458486msgid ""
459487"Read the source text as UTF-8, ignoring its :pep:`263` encoding declaration "
460488"(\" coding cookie\" ), if any:"
461489msgstr ""
490+ "將原始文字以 UTF-8 讀取,忽略其 :pep:`263` 編碼宣告(「coding cookie」,如果"
491+ "有的話):"
462492
463493#: ../../c-api/veryhigh.rst:406
464494msgid ""
@@ -477,20 +507,38 @@ msgid ""
477507"flags.cf_flags = PyCF_IGNORE_COOKIE;\n"
478508"Py_CompileStringFlags(source, \" <input>\" , Py_file_input, &flags);"
479509msgstr ""
510+ "PyCompilerFlags flags = {\n"
511+ " .cf_flags = 0,\n"
512+ " .cf_feature_version = PY_MINOR_VERSION,\n"
513+ "};\n"
514+ "const char *source = \" # coding: latin-1\\ ns = '\\ xe9'\\ n\" ;\n"
515+ "\n"
516+ "/* coding cookie 被遵循:位元組 0xE9 被解碼為\n"
517+ " Latin-1,這會回傳一個將 s 設為 \" é\" 的程式碼物件: */\n"
518+ "Py_CompileStringFlags(source, \" <input>\" , Py_file_input, &flags);\n"
519+ "\n"
520+ "/* 加上此旗標後,cookie 會被忽略,導致編譯失敗\n"
521+ " 並出現 SyntaxError,因為 0xE9 不是有效的 UTF-8: */\n"
522+ "flags.cf_flags = PyCF_IGNORE_COOKIE;\n"
523+ "Py_CompileStringFlags(source, \" <input>\" , Py_file_input, &flags);"
480524
481525#: ../../c-api/veryhigh.rst:423
482526msgid ""
483527"The :func:`compile`, :func:`eval` and :func:`exec` built-in functions set "
484528"this flag when the source is a :class:`str` object, because they pass the "
485529"text to the parser encoded as UTF-8."
486530msgstr ""
531+ ":func:`compile`、:func:`eval` 和 :func:`exec` 這幾個內建函式,會在原始碼是 :"
532+ "class:`str` 物件時設定此旗標,因為它們會將文字以 UTF-8 編碼傳遞給剖析器。"
487533
488534#: ../../c-api/veryhigh.rst:429
489535msgid ""
490536"Mark the source text as known to be UTF-8 encoded. The :func:`compile`, :"
491537"func:`eval` and :func:`exec` built-in functions set this flag, but it "
492538"currently has no effect."
493539msgstr ""
540+ "將原始文字標記為已知採用 UTF-8 編碼。:func:`compile`、:func:`eval` 和 :func:"
541+ "`exec` 這幾個內建函式會設定此旗標,但目前沒有任何效果。"
494542
495543#: ../../c-api/veryhigh.rst:433
496544msgid ""
@@ -502,7 +550,7 @@ msgstr ""
502550
503551#: ../../c-api/veryhigh.rst:438
504552msgid "The following masks combine several flags:"
505- msgstr ""
553+ msgstr "以下的遮罩結合了數個旗標: "
506554
507555#: ../../c-api/veryhigh.rst:442
508556msgid ""
@@ -512,24 +560,34 @@ msgid ""
512560"__future__ import`` statement, the flag for the imported feature is added to "
513561"*flags*, so that code executed later in the same context inherits it."
514562msgstr ""
563+ "所有 ``CO_FUTURE`` 旗標的位元遮罩(請參閱 :ref:`c_codeobject_flags`),這些旗"
564+ "標用來選擇通常由 :ref:`future 陳述式 <future>`\\ 啟用的功能。當使用 "
565+ "``PyCompilerFlags *flags`` 引數編譯的程式碼包含 ``from __future__ import`` 陳"
566+ "述式時,該匯入功能所對應的旗標會被加入 *flags* 中,讓稍後在同一情境中執行的程"
567+ "式碼繼承它。"
515568
516569#: ../../c-api/veryhigh.rst:452
517570msgid ""
518571"Do not use this mask in new code. It is kept only so that old code passing "
519572"its flags to :func:`compile` keeps working."
520573msgstr ""
574+ "請勿在新程式碼中使用此遮罩,保留它只是為了讓傳遞其旗標給 :func:`compile` 的舊"
575+ "有程式碼能繼續運作。"
521576
522577#: ../../c-api/veryhigh.rst:455
523578msgid ""
524579"Bitmask of flags for obsolete future features that no longer have any effect."
525- msgstr ""
580+ msgstr "已過時且不再有任何作用的 future 功能旗標之位元遮罩。 "
526581
527582#: ../../c-api/veryhigh.rst:460
528583msgid ""
529584"Bitmask of all ``PyCF`` flags that change how the source is compiled, such "
530585"as :c:macro:`PyCF_ONLY_AST`. The :func:`compile` built-in function uses this "
531586"mask to validate its *flags* argument."
532587msgstr ""
588+ "所有會改變原始碼編譯方式的 ``PyCF`` 旗標之位元遮罩,例如 :c:macro:"
589+ "`PyCF_ONLY_AST`。:func:`compile` 這個內建函式使用此遮罩來驗證其 *flags* 引"
590+ "數。"
533591
534592#: ../../c-api/veryhigh.rst:469
535593msgid "Available start symbols"
0 commit comments