diff options
author | Brett Cannon <brett@python.org> | 2013-06-14 22:33:00 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-06-14 22:33:00 (GMT) |
commit | 33915eba7c8293eab4962345fbbb1e5d193295ed (patch) | |
tree | 320c366c8c8f651c6c0d515b662f8cecf2e41cac /Doc/library/py_compile.rst | |
parent | 3fe35e65034de82c45e2d8fe1ebe4a2929c68453 (diff) | |
download | cpython-33915eba7c8293eab4962345fbbb1e5d193295ed.zip cpython-33915eba7c8293eab4962345fbbb1e5d193295ed.tar.gz cpython-33915eba7c8293eab4962345fbbb1e5d193295ed.tar.bz2 |
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.rst | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst index 0c8c99d..bae8450 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) |