[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

Brett Cannon report at bugs.python.org
Fri Jan 17 15:49:14 CET 2014


Brett Cannon added the comment:

While you're right, Marcel, that code which pulls out the file object form FieldStorage would probably have the file closed from underneath it, I don't know if I agree that it's a bad thing. The FieldStorage object created that file, implicitly putting it in charge of managing it. Having it guarantee that it gets closed seems to me totally reasonable and a bug not to do so. And having Bottle break as-is doesn't sway me as this is a bug fix and so updating Bottle as part of the process to support Python 3.4 is reasonable.

That use of the term "leisure" is definitely a problem, though. So I'm going to make this a bug report for updating the docs to no longer use the term "leisure" and add a versionchanged note that FieldStorage will close the 'file' attribute upon deletion. I'll also opened http://bugs.python.org/issue20289 to add context manager support to FieldStorage.

But since leaving files randomly open is not good I can't bring myself to revert this change.

----------

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


More information about the Python-bugs-list mailing list