diff --git a/Lib/xml/sax/expatreader.py b/Lib/xml/sax/expatreader.py index c9fc894cb08..a227cdab572 100644 --- a/Lib/xml/sax/expatreader.py +++ b/Lib/xml/sax/expatreader.py @@ -219,6 +219,9 @@ def close(self): self._parsing = 0 # break cycle created by expat handlers pointing to our methods self._parser = None + bs = self._source.getByteStream() + if bs is not None: + bs.close() def _reset_cont_handler(self): self._parser.ProcessingInstructionHandler = \