[Python-ideas] Proporsal: Show an alert in traceback when the source file is newer than compiled code (issue8087)

Nick Coghlan ncoghlan at gmail.com
Mon Oct 10 09:54:06 CEST 2011


On Sat, Oct 8, 2011 at 10:37 PM, Diego Mascialino <dmascialino at gmail.com> wrote:
> On Fri, Oct 7, 2011 at 8:04 PM, Cameron Simpson <cs at zip.com.au> wrote:
>>
>> Only when the traceback was being printed. You would need to stash the
>> modtime at import for later reference.
>
>
> Actually the source file modtime there is in the compiled source (.pyc).
> Import use this information to know if is necessary to compile the source again.
>
> In my patch, when a traceback is going to be printed, I compare the
> actual modtime
> with the modtime stored in the pyc.

Having been caught by this myself on occasion, warning in the
traceback certainly sounds like a reasonable hint to provide. I posted
a comment to the tracker to that effect (also noting that even with
this hint, reloading still has its own problems with stale references
to previous incarnation of the module).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list