diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-02-06 08:21:37 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-02-06 08:21:37 (GMT) |
commit | bf5e9604cc5a5ae61181b093193286f06a502ad6 (patch) | |
tree | c20966ea695e430b9dddae88196def7aca84f309 /Lib/cgi.py | |
parent | 088ca8b9470e51b932b73d6b39d970b0292f2ba3 (diff) | |
download | cpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.zip cpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.tar.gz cpython-bf5e9604cc5a5ae61181b093193286f06a502ad6.tar.bz2 |
Issue #20289: cgi.FieldStorage() now supports the context management protocol.
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-x | Lib/cgi.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -566,6 +566,12 @@ class FieldStorage: except AttributeError: pass + def __enter__(self): + return self + + def __exit__(self, *args): + self.file.close() + def __repr__(self): """Return a printable representation.""" return "FieldStorage(%r, %r, %r)" % ( |