[Python-ideas] disabling .pyc and .pyo files
collinw at gmail.com
Thu Dec 10 05:47:05 CET 2009
On Wed, Dec 9, 2009 at 7:48 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Ben Finney <ben+python at ...> writes:
>> Guido van Rossum <guido <at> python.org> writes:
>> > Could it be as simple as this:
>> > -b don't read bytecode (new flag)
>> > -B don't write bytecode (existing flag)
>> Almost, but I think many in this discussion are agitating for “don't
>> read orphaned bytecode” to become the default.
> Either to become the default (which might require updates to things like
> py2exe), or to have a dedicated flag.
> On the other hand, a flag not to read bytecode /at all/ doesn't seem to have an
> use case. If you don't want to read any bytecode, don't produce/install it in
> the first place.
I gave such a use-case earlier in this thread:
It would also be useful when benchmarking multiple iterations of the
same VM. I've considered implementing something like this for Unladen
Swallow so that we could more effectively isolate the running binary
from global state (with a sys.dont_read_bytecode command-line flag
doing for bytecode files what -E does for environment variables).
We currently handle this by deleting all .pyc/.pyo files in our
library tree, but that gets more expensive the more third-party
libraries we bring in for testing, and it's not foolproof.
More information about the Python-ideas