mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
provide __next__() and use native next() to support py2/py3 in one source. refs #1350.
This commit is contained in:
@@ -1187,7 +1187,7 @@ class _IterParseIterator(object):
|
||||
append((event, None))
|
||||
parser.EndNamespaceDeclHandler = handler
|
||||
|
||||
def next(self):
|
||||
def __next__(self):
|
||||
while 1:
|
||||
try:
|
||||
item = self._events[self._index]
|
||||
@@ -1208,6 +1208,8 @@ class _IterParseIterator(object):
|
||||
self._index = self._index + 1
|
||||
return item
|
||||
|
||||
next = __next__ # Python 2 compatibility
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
|
||||
Reference in New Issue
Block a user