Author Stefanik Gábor
Recipients Stefanik Gábor
Date 2019-07-11.10:02:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562839334.01.0.637880829238.issue37560@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-07-11 10:02:14Stefanik Gáborsetrecipients: + Stefanik Gábor
2019-07-11 10:02:14Stefanik Gáborsetmessageid: <1562839334.01.0.637880829238.issue37560@roundup.psfhosted.org>
2019-07-11 10:02:13Stefanik Gáborlinkissue37560 messages
2019-07-11 10:02:13Stefanik Gáborcreate