@@ -63,6 +63,13 @@ msgid ""
6363"``sys.stderr``, but no exception is raised. This function returns the path "
6464"to byte-compiled file, i.e. whatever *cfile* value was used."
6565msgstr ""
66+ "将源文件编译成字节码并写出字节码缓存文件。 源代码从名为 *file* 的文件中加载。 字节码会写入到 *cfile*,默认为 "
67+ ":pep:`3147`/:pep:`488` 路径,以 ``.pyc`` 结尾。 举例来说,如果 *file* 是 "
68+ "``/foo/bar/baz.py`` 则对于 Python 3.2 *cfile* 将默认为 "
69+ "``/foo/bar/__pycache__/baz.cpython-32.pyc``。 如果指定了 *dfile*,则在错误信息中它将代替 "
70+ "*file* 作为源文件的名称。 如果 *doraise* 为真值,则当编译 *file* 遇到错误时将会引发 "
71+ ":exc:`PyCompileError`。 如果 *doraise* 为假值(默认),则将写入错误信息到 "
72+ "``sys.stderr``,但不会引发异常。 此函数返回编译后字节码文件的路径,即 *cfile* 所使用的值。"
6673
6774#: ../../library/py_compile.rst:45
6875msgid ""
@@ -73,6 +80,10 @@ msgid ""
7380":exc:`PyCompileError` is raised instead. However if *quiet* is 2, no message"
7481" is written, and *doraise* has no effect."
7582msgstr ""
83+ "*doraise* 和 *quiet* 参数确定在编译文件时如何处理错误。 如果 *quiet* 为 0 或 1,并且 *doraise* "
84+ "为假值,则会启用默认行为:写入错误信息到 ``sys.stderr``,并且函数将返回 ``None`` 而非一个路径。 如果 *doraise* "
85+ "为真值,则将改为引发 :exc:`PyCompileError`。 但是如果 *quiet* 为 2,则不会写入消息,并且 *doraise* "
86+ "也不会有效果。"
7687
7788#: ../../library/py_compile.rst:52
7889msgid ""
@@ -83,13 +94,17 @@ msgid ""
8394"a side-effect of import using file renaming to place the final byte-compiled"
8495" file into place to prevent concurrent file writing issues."
8596msgstr ""
97+ "如果 *cfile* 所表示(显式指定或计算得出)的路径为符号链接或非常规文件,则将引发 :exc:`FileExistsError`。 "
98+ "此行为是用来警告如果允许写入编译后字节码文件到这些路径则导入操作将会把它们转为常规文件。 "
99+ "这是使用文件重命名来将最终编译后字节码文件放置到位以防止并发文件写入问题的导入操作的附带效果。"
86100
87101#: ../../library/py_compile.rst:59
88102msgid ""
89103"*optimize* controls the optimization level and is passed to the built-in "
90104":func:`compile` function. The default of ``-1`` selects the optimization "
91105"level of the current interpreter."
92106msgstr ""
107+ "*optimize* 控制优化级别并会被传给内置的 :func:`compile` 函数。 默认值 ``-1`` 表示选择当前解释器的优化级别。"
93108
94109#: ../../library/py_compile.rst:63
95110msgid ""
0 commit comments