[New-bugs-announce] [issue11132] compileall.compile_dir loses 'optimize' parameter in recursion.

July Tikhonov report at bugs.python.org
Sun Feb 6 12:03:22 CET 2011


New submission from July Tikhonov <july.tikh at gmail.com>:

july at julynote:~/test> ls -R
.:
c.py  subdir

./subdir:
a.py  b.py
july at julynote:~/test> python3
Python 3.2rc2+ (py3k, Feb  6 2011, 13:06:04) 
[GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from compileall import compile_dir
>>> compile_dir('.', optimize=1)
Listing . ...
Compiling ./c.py ...
Listing ./subdir ...
Compiling ./subdir/a.py ...
Compiling ./subdir/b.py ...
1
>>> 
july at julynote:~/test> ls -R
.:
c.py  __pycache__  subdir

./__pycache__:
c.cpython-32.pyo

./subdir:
a.py  b.py  __pycache__

./subdir/__pycache__:
a.cpython-32.pyc  b.cpython-32.pyc
july at julynote:~/test>

It seems that the bug was introduced in svn revision 87019 (Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.).

In recursion, 'optimize' parameter is lost and replaced by default -1 (optimize level of the interpreter).

Test patch added.

----------
components: Library (Lib)
files: compileall.compile_dir.optimize.test.diff
keywords: patch
messages: 128048
nosy: july
priority: normal
severity: normal
status: open
title: compileall.compile_dir loses 'optimize' parameter in recursion.
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file20696/compileall.compile_dir.optimize.test.diff

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


More information about the New-bugs-announce mailing list