[Python-ideas] disabling .pyc and .pyo files

geremy condra debatem1 at gmail.com
Wed Dec 9 01:07:35 CET 2009

On Tue, Dec 8, 2009 at 2:27 PM, John Arbash Meinel
<john.arbash.meinel at gmail.com> wrote:
> Guido van Rossum wrote:
>> -B only blocks *writing* of bytecode. I think the OP wants to block
>> *reading*, and only in the specific case where there is no
>> corresponding source code file.
>> 2009/12/8 Todd Whiteman <toddw at activestate.com>:
>>> Kristján Valur Jónsson wrote:
>>>> I looked at the import code and I found that it is trivial to block the
>>>> reading and writing of .pyo files.  I am about to implement that patch for
>>>> our purposes, thus forcing recompilation of the .py files on each run if so
>>>> specified.   This will ensure that the application will execute only the
>>>> code represented by the checked-out .py files.  But it occurred to me that
>>>> this functionality might be of interest to other people than just us.  I can
>>>> imagine, for example, that buildbots running the python regression testsuite
>>>> might be running into problems with stray .pyo files from time to time.
>>>> Do you think that such a command line option would be useful for Python at
>>>> large?
>>> Yes, this is already implemented (as of Python 2.6), see -B option:
>>> http://www.python.org/doc/2.6.4/using/cmdline.html#miscellaneous-options
> This would be quite nice for us. In our case we have been bit several
> times during refactoring. You move one file, but your test suite still
> passes because .pyc is still around.

Same experience here.

Geremy Condra

More information about the Python-ideas mailing list