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

Brett Cannon brett at python.org
Tue Dec 8 20:51:04 CET 2009


On Tue, Dec 8, 2009 at 11:34, Raymond Hettinger <python at rcn.com> wrote:

>
>  Repeatedly we run into trouble because of stray .pyo (and/or .pyc) files.
>>> This can happen for a variety of reasons, but most often it occurs when
>>> .py
>>> files are being removed, or moved in the hierarchy. The problem is that
>>> the
>>> application will happily load and import an orphaned .pyo file, even
>>> though
>>> the .py file has gone or moved.
>>>
>>
> I've seen this same problem occur for a number of users.
> It is recurring opportunity to get tripped-up.


Another way that a sys.dont_read_bytecode flag would be helpful is for VMs
that don't use Python bytecode (e.g. Jython). They could set this flag to
True by default which allows code to introspect on the VM to see if it is
using bytecode or not. Plus it would let importlib easily skip bytecode
usage on VMs that don't support it instead of trying to come up with some
heuristic to pick up on that fact (I have not figured that one out yet, but
Jython folk were thinking about having marshal.loads() always throw an
exception).

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20091208/de7fec20/attachment.html>


More information about the Python-ideas mailing list