Disable use of pyc file with no matching py file

John Roth johnroth1 at gmail.com
Tue Jan 31 15:20:56 EST 2012


On Jan 30, 3:43 pm, Terry Reedy <tjre... at udel.edu> wrote:
> On 1/30/2012 4:30 PM, Roy Smith wrote:
>
> > Every so often (typically when refactoring), I'll remove a .py file
> > and forget to remove the corresponding .pyc file.  If I then import
> > the module, python finds the orphaned .pyc and happily imports it.
> > Usually leading to confusing and hard to debug failures.
>
> > Is there some way to globally tell python, "Never import a .pyc
> > unless the corresponding .py file exits"?
>
> Upgrade to 3.2.
>
> --
> Terry Jan Reedy

Terry,

I've noticed that the tutorial (section 6.1.3) hasn't been updated for
PEP 3147; there's no way of telling that this is the behavior from
reading the tutorial. The development doc for 3.3 hasn't been updated
either.



More information about the Python-list mailing list