bpo-30264: ExpatParser closes the source on error by vstinner · Pull Request #1451 · python/cpython

This was referenced

May 4, 2017

@vstinner vstinner changed the title bpo-30264: xml.sax.parse() now closes the source bpo-30264: ExpatParser closes the source on error

May 5, 2017

@vstinner

ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.

vstinner added a commit that referenced this pull request

May 5, 2017
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.
(cherry picked from commit ef9c0e7)

vstinner added a commit that referenced this pull request

May 5, 2017
ExpatParser.parse() of xml.sax.xmlreader now always closes the
source: close the file object or the urllib object if source is a
string (not an open file-like object). The change fixes a
ResourceWarning on parsing error.

Add test_parse_close_source() unit test.
(cherry picked from commit ef9c0e7)