bpo-15999: Always pass bool instead of int to the expat parser. (GH-15622)

This commit is contained in:
Serhiy Storchaka 2019-09-01 12:11:43 +03:00 committed by GitHub
parent 41c57b3353
commit eb8974616b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 36 deletions

View file

@ -93,7 +93,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
self._parser = None
self._namespaces = namespaceHandling
self._lex_handler_prop = None
self._parsing = 0
self._parsing = False
self._entity_stack = []
self._external_ges = 0
self._interning = None
@ -203,10 +203,10 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
# IncrementalParser methods
def feed(self, data, isFinal = 0):
def feed(self, data, isFinal=False):
if not self._parsing:
self.reset()
self._parsing = 1
self._parsing = True
self._cont_handler.startDocument()
try:
@ -237,13 +237,13 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
# If we are completing an external entity, do nothing here
return
try:
self.feed("", isFinal = 1)
self.feed(b"", isFinal=True)
self._cont_handler.endDocument()
self._parsing = 0
self._parsing = False
# break cycle created by expat handlers pointing to our methods
self._parser = None
finally:
self._parsing = 0
self._parsing = False
if self._parser is not None:
# Keep ErrorColumnNumber and ErrorLineNumber after closing.
parser = _ClosedParser()
@ -307,7 +307,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
self._parser.SetParamEntityParsing(
expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
self._parsing = 0
self._parsing = False
self._entity_stack = []
# Locator methods