[Python-Dev] __pycache__ creation
ijmorlan at uwaterloo.ca
Mon Mar 22 18:28:25 CET 2010
On Mon, 22 Mar 2010, Antoine Pitrou wrote:
> Oh, and by the way, there can be a race condition between __pycache__
> creation and deletion (if it fails the test), where an attacker can stuff
> a hostile pyc file in the directory in the meantime (and the deletion
> then fails because the directory isn't empty).
Would creating it under a different name and then renaming help with this?
> IMO, all these issues militate for putting __pycache__ creation out of
> the interpreter core, and in the hands of third-party package-time/
> install-time tools (or distutils).
Speaking only for myself, but really for anybody who likes tidy source
directories, I hope some version of the __pycache__ proposal becomes part
of standard Python, by which I ideally mean it's enabled by default but if
that is just not a good idea then at most it should be required to set a
command-line option to get this feature.
If I just want to write some .py code and run it, I don't see why my
directories need to clutter up with .pyc files. I've previously suggested
a Python version of javac's -d ("destination directory") option, but
putting all the .pyc's in a __pycache__ directory per source directory is
good enough to make me happy (and is Pythonically simple, in my opinion).
Isaac Morland CSCF Web Guru
DC 2554C, x36650 WWW Software Specialist
More information about the Python-Dev