[issue28867] NamedTemporaryFile does not generate a ResourceWarning for unclosed files (unlike TemporaryFile)

Jon Dufresne report at bugs.python.org
Sun Dec 11 11:53:55 EST 2016


Jon Dufresne added the comment:

I've taken a new approach to resolve the urllib issues.

I believe HTTPError _should not_ warn when __del__ is called as HTTPError wraps an existing resource instead of generating its own. IIUC, in this case, I believe it falls to the responsibility of code generating the resource to properly close and manage the resource (or pass that responsibility along). If I misunderstood, please let me know.

All feedback on the patch is welcome, thanks.

----------
Added file: http://bugs.python.org/file45851/namedtemporaryfile-resourcewarning-3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28867>
_______________________________________


More information about the Python-bugs-list mailing list