Nick Coghlan <ncogh...@gmail.com> added the comment:

(just reviewing the idea here, not the current patch)

The problem of "stale code" (i.e. what was executed doesn't match what is 
displayed in the traceback) is a tricky and subtle one. There are a few 
different cases:

1. Source displayed does not match source on disk
- these cases do happen, but they're almost always due to straight up bugs in 
the linecache or traceback modules.
2. Source has been changed, but module has not been reloaded
- this is the case for "edited source file but forgot to reload module". I've 
certainly forgotten to do this myself, and I'm far from the only one. This is 
the case Diego's RFE targets, and I think it has some merit.
3. Source has been changed, module has been reloaded, but object reference is 
from previous version of module
- the patch doesn't detect this. There are various ways we *could* detect it, 
but they all involve some fairly significant changes to the way compilation and 
module import work.

Aspect 3 is a much deeper (and bigger) problem relating to native introspection 
support in function and class objects. But that doesn't make Diego's idea to 
improve Aspect 2 invalid - there have certainly been times when playing at the 
interactive prompt that such a warning would have reminded me that I needed to 
reload the module I was working on.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8087>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to