This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pitrou, vstinner
Date 2013-10-28.12:56:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382965005.47.0.406441532744.issue19421@psf.upfronthosting.co.za>
In-reply-to
Content
By the way, the filename of the warning is not really useful. Example script test.py:
---------------------
f = open(__file__)
---------------------

At exit, Python displays:
---------------------
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='test.py' mode='r' encoding='UTF-8'>
---------------------

"sys" is not a real file, _Py_DisplaySourceLine() would not be able to display the Python line (the correct filename is test.py).

Python traceback when the warning is emitted, according to gdb:
---------------------
(gdb) py-bt
Traceback (most recent call first):
  <built-in method _dealloc_warn of _io.FileIO object at remote 0x7ffff1a04368>
  <built-in method _dealloc_warn of _io.BufferedReader object at remote 0x7ffff1ae4838>
  <built-in method close of _io.TextIOWrapper object at remote 0x7ffff1b97dc0>
---------------------

We are in PyImport_Cleanup(), called by Py_Finalize().
History
Date User Action Args
2013-10-28 12:56:45vstinnersetrecipients: + vstinner, pitrou
2013-10-28 12:56:45vstinnersetmessageid: <1382965005.47.0.406441532744.issue19421@psf.upfronthosting.co.za>
2013-10-28 12:56:45vstinnerlinkissue19421 messages
2013-10-28 12:56:45vstinnercreate