diff options
author | Brett Cannon <brett@python.org> | 2013-08-23 19:15:48 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-08-23 19:15:48 (GMT) |
commit | f79126f373a9d5c9b584a8db736fe490fcbfa77a (patch) | |
tree | 18a06f40da038953f80ccb86658f8d361924b1b2 | |
parent | 9c7eb5557022e0682fbfc74e524cae8a9a2bc702 (diff) | |
download | cpython-f79126f373a9d5c9b584a8db736fe490fcbfa77a.zip cpython-f79126f373a9d5c9b584a8db736fe490fcbfa77a.tar.gz cpython-f79126f373a9d5c9b584a8db736fe490fcbfa77a.tar.bz2 |
Issue #18394: Explicitly close the file object cgi.FieldStorage
caches.
Eliminates the ResoureWarning raised during testing.
Patch also independently written by Vajrasky Kok.
-rwxr-xr-x | Lib/cgi.py | 6 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
2 files changed, 8 insertions, 0 deletions
@@ -552,6 +552,12 @@ class FieldStorage: else: self.read_single() + def __del__(self): + try: + self.file.close() + except AttributeError: + pass + def __repr__(self): """Return a printable representation.""" return "FieldStorage(%r, %r, %r)" % ( @@ -38,6 +38,8 @@ Core and Builtins Library ------- +- Issue #18394: Close cgi.FieldStorage's optional file. + - Issue #17702: On error, os.environb now removes suppress the except context when raising a new KeyError with the original key. |