xmltok: Change StopIteration to EOFError due to PEP-479.

Due to changes in MicroPython to support PEP-479, StopIteration has been
deprecated for return.  This results in xmltok to raise RuntimeError every
time.  This commit is a simple fix to just change from StopIteration to
EOFError and then return it in the generator.
pull/411/head
ThunderEX 2021-02-03 09:34:28 +08:00 zatwierdzone przez Damien George
rodzic fe3e0a2fae
commit 66924d9fa1
1 zmienionych plików z 33 dodań i 30 usunięć

Wyświetl plik

@ -31,7 +31,7 @@ class XMLTokenizer:
def nextch(self):
self.c = self.f.read(1)
if not self.c:
raise StopIteration
raise EOFError
return self.c
def skip_ws(self):
@ -87,6 +87,7 @@ class XMLTokenizer:
def tokenize(self):
while not self.eof():
try:
if self.match("<"):
if self.match("/"):
yield (END_TAG, self.getnsident())
@ -117,6 +118,8 @@ class XMLTokenizer:
text += self.getch()
if text:
yield (TEXT, text)
except EOFError:
pass
def gfind(gen, pred):