Message315843
| Author |
takluyver |
| Recipients |
Rhamphoryncus, gvanrossum, nnorwitz, takluyver, zseil |
| Date |
2018年04月27日.13:54:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1524837290.13.0.682650639539.issue1692664@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|