changeset 25171:d647f97f88dd

parsers: use 'next' instead of try/except This get rid of another StopIteration abomination. The change in self.current value is supposed to not matter as nobody should be calling '_advance' after that (as per Matt wisdom).
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 May 2015 12:27:15 -0500
parents c69f4f7fe01a
children ca9c02cb81be
files mercurial/parser.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parser.py	Mon May 18 12:22:44 2015 -0500
+++ b/mercurial/parser.py	Mon May 18 12:27:15 2015 -0500
@@ -27,10 +27,7 @@
     def _advance(self):
         'advance the tokenizer'
         t = self.current
-        try:
-            self.current = self._iter.next()
-        except StopIteration:
-            pass
+        self.current = next(self._iter, None)
         return t
     def _match(self, m, pos):
         'make sure the tokenizer matches an end condition'