[New-bugs-announce] [issue27226] distutils: unable to compile both .opt-1.pyc and .opt2.pyc simultaneously

Michał Górny report at bugs.python.org
Sun Jun 5 02:03:29 EDT 2016

New submission from Michał Górny:

Since 3.5, optimized Python modules for -O and -OO are installed using different names. The Python build system itself seems to been prepared for this as Python itself is built with both .opt-1.pyc and .opt-2.pyc files built. However, distutils at the moment can only install one of them.

Gentoo is relying on 'setup.py install --compile -O2' doing the right thing. We can change the arguments if necessary but calling it twice would require a lot of conditional changes to how we build packages. Of course, not installing both variants is not an option since it causes Python to attempt to write them at runtime later.

Could we please get some way to build both .opt-1.pyc and .opt-2.pyc in setup.py install? Either through making -O2 build also -O1 implicitly, or providing an ability to specify multiple optimization levels.

Relevant Gentoo bug: https://bugs.gentoo.org/585060

components: Distutils
messages: 267389
nosy: dstufft, eric.araujo, mgorny
priority: normal
severity: normal
status: open
title: distutils: unable to compile both .opt-1.pyc and .opt2.pyc simultaneously
type: behavior
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list