This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2017-05-03.23:50:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493855404.54.0.178478037782.issue30264@psf.upfronthosting.co.za>
In-reply-to
Content
Running test_sax of Python 2.7 on Windows emits the following warning:

Warning -- files was modified by test_sax

The problem is that os.unlink(TESTFN) ignores all OSError: os.unlink(TESTFN) fails because there is still an open file object somewhere.

The bug is in the test_parse_bytes() of test_sax, on check_parse(TESTFN) which raises an exception as expected.

xml.sax.parse() should close the parser on exception.


On master, test_sax explicitly expects a ResourceWarning, WTF?

        with support.check_warnings(('unclosed file', ResourceWarning)):                           
            # XXX Failed parser leaks an opened file.                                              
            with self.assertRaises(SAXException):                                                  
                self.check_parse(TESTFN)                                                           
            # Collect leaked file.                                                                 
            gc.collect()


See also issue #15388.
History
Date User Action Args
2017-05-03 23:50:04vstinnersetrecipients: + vstinner
2017-05-03 23:50:04vstinnersetmessageid: <1493855404.54.0.178478037782.issue30264@psf.upfronthosting.co.za>
2017-05-03 23:50:04vstinnerlinkissue30264 messages
2017-05-03 23:50:04vstinnercreate