summaryrefslogtreecommitdiff
path: root/Doc/library/py_compile.rst
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-14 18:33:00 -0400
committerBrett Cannon <brett@python.org>2013-06-14 18:33:00 -0400
commitb8d309549d4eea268d48f457efb6fe9c61146f3f (patch)
tree4eeb5f660f3174973521129c106ac3efeb9a097c /Doc/library/py_compile.rst
parent6e12a5b79c654c1a6bdbb79d8792d4a7b3d26eb8 (diff)
downloadcpython-b8d309549d4eea268d48f457efb6fe9c61146f3f.tar.gz
Issue #17222: Raise FileExistsError when py_compile.compile would
overwrite a symlink or non-regular file with a regular file.
Diffstat (limited to 'Doc/library/py_compile.rst')
-rw-r--r--Doc/library/py_compile.rst11
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst
index 0c8c99d3bf..bae8450b7c 100644
--- a/Doc/library/py_compile.rst
+++ b/Doc/library/py_compile.rst
@@ -41,6 +41,13 @@ byte-code cache files in the directory containing the source code.
is raised. This function returns the path to byte-compiled file, i.e.
whatever *cfile* value was used.
+ If the path that *cfile* becomes (either explicitly specified or computed)
+ is a symlink or non-regular file, :exc:`FileExistsError` will be raised.
+ This is to act as a warning that import will turn those paths into regular
+ files if it is allowed to write byte-compiled files to those paths. This is
+ a side-effect of import using file renaming to place the final byte-compiled
+ file into place to prevent concurrent file writing issues.
+
*optimize* controls the optimization level and is passed to the built-in
:func:`compile` function. The default of ``-1`` selects the optimization
level of the current interpreter.
@@ -53,7 +60,9 @@ byte-code cache files in the directory containing the source code.
.. versionchanged:: 3.4
Changed code to use :mod:`importlib` for the byte-code cache file writing.
This means file creation/writing semantics now match what :mod:`importlib`
- does, e.g. permissions, write-and-move semantics, etc.
+ does, e.g. permissions, write-and-move semantics, etc. Also added the
+ caveat that :exc:`FileExistsError` is raised if *cfile* is a symlink or
+ non-regular file.
.. function:: main(args=None)