Message262384
| Author |
vstinner |
| Recipients |
Arfrever, msmhrt, ned.deily, pitrou, python-dev, serhiy.storchaka, vstinner |
| Date |
2016年03月24日.23:15:09 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1458861309.87.0.922704195885.issue21925@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
It looks like logging a warning at Python exit always works on Python 2.7:
---
import _warnings
class Bla:
def __del__(self, w=_warnings):
w.warn_explicit('message', DeprecationWarning, 'x.py', 5)
bla = Bla()
---
It looks like it uses the Python implementation and linecache.getline() always works. Maybe the warning is emitted earlier that the Python 3 code emitting ResourceWarning. I see that warnings.py of Python 2 imports linecache at top level, whereas the Python 3 code imports the module at the first use in showwarning(). I recall that imports at top level are avoided to get faster startup time. |
|