kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
fe3e0a2fae
commit
66924d9fa1
|
@ -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):
|
||||
|
|
Ładowanie…
Reference in New Issue