[New-bugs-announce] [issue8563] [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files

Arfrever Frehtes Taifersar Arahesis report at bugs.python.org
Wed Apr 28 22:01:41 CEST 2010


New submission from Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA at GMail.Com>:

compileall.compile_file() creates empty __pycache__ directories for non-.py files.
This problem usually occurs when compileall.compile_file() is called by compileall.compile_dir() and a subdirectory contains non-code files (e.g. locales, images, templates, documentation).
__pycache__ directories also should not be created when generation of .pyc / .pyo files failed due to e.g. SyntaxErrors.
I'm attaching the patch.

$ mkdir test
$ touch test/file
$ tree test
test
└── file

0 directories, 1 file
$ python3.2 -c 'import compileall; compileall.compile_file("test/file")'
$ tree test
test
├── file
└── __pycache__

1 directory, 1 file

----------
components: Library (Lib)
files: compileall.patch
keywords: patch
messages: 104458
nosy: Arfrever, barry
priority: normal
severity: normal
status: open
title: [PEP 3147] compileall.compile_file() creates empty __pycache__ directories for non-.py files
versions: Python 3.2
Added file: http://bugs.python.org/file17121/compileall.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8563>
_______________________________________


More information about the New-bugs-announce mailing list