Message315843
Time for some bug archaeology!
The reason given for not using frame.f_code.co_filename for warnings was that it can be wrong when the path of .pyc files changes. However, it looks like that was fixed in #1180193 (thanks for the pointer zseil), so I'd like this idea to be reconsidered.
Python uses frame.f_code.co_filename for tracebacks and in pdb, so it's counterintuitive that the warnings module works differently. They are all trying to do the same thing: find and show the bit of code that you're interested in.
This causes problems in IPython with warnings attributed to interactive code: warnings sees it all as part of the __main__ module, so we can't distinguish which input it's pointing to (it's usually obvious, but still...). We have integrated with linecache to make tracebacks work, and I think that if warnings used code.co_filename, it would also work as expected. |
|
Date |
User |
Action |
Args |
2018-04-27 13:54:50 | takluyver | set | recipients:
+ takluyver, gvanrossum, nnorwitz, Rhamphoryncus, zseil |
2018-04-27 13:54:50 | takluyver | set | messageid: <1524837290.13.0.682650639539.issue1692664@psf.upfronthosting.co.za> |
2018-04-27 13:54:50 | takluyver | link | issue1692664 messages |
2018-04-27 13:54:50 | takluyver | create | |
|