New submission from Stefanik Gábor <[email protected]>:
cgi.FieldStorage has this for its __del__ method:
def __del__(self):
try:
self.file.close()
except AttributeError:
pass
By contrast, __exit__ is missing the exception handler:
def __exit__(self, *args):
self.file.close()
Because self.file isn't populated in every instance of the FieldStorage class,
this can cause FieldStorage to fail with AttributeError when used in a with
statement.
----------
components: Library (Lib)
messages: 347667
nosy: Stefanik Gábor
priority: normal
severity: normal
status: open
title: with cgi.FieldStorage(...) fails on cleanup with AttributeError, missing
try/except in __exit__
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37560>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com