[pypy-svn] r68735 - pypy/trunk/pypy/interpreter/pyparser

benjamin at codespeak.net benjamin at codespeak.net
Sun Oct 25 15:31:22 CET 2009


Author: benjamin
Date: Sun Oct 25 15:31:18 2009
New Revision: 68735

Modified:
   pypy/trunk/pypy/interpreter/pyparser/future.py
Log:
make sure to capture the name correctly even if there is whitespace afterwards

Modified: pypy/trunk/pypy/interpreter/pyparser/future.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyparser/future.py	(original)
+++ pypy/trunk/pypy/interpreter/pyparser/future.py	Sun Oct 25 15:31:18 2009
@@ -241,18 +241,18 @@
             raise DoneException
         p = self.pos
         try:
-            while 1:
+            while self.getc() in alphanumerics:
                 self.pos += 1
-                if self.getc() not in alphanumerics:
-                    break
         except DoneException:
             # If there's any name at all, we want to call self.set_flag().
             # Something else while get the DoneException again.
             if self.pos == p:
                 raise
+            end = self.pos
         else:
+            end = self.pos
             self.consume_whitespace()
-        return self.s[p:self.pos]
+        return self.s[p:end]
 
     def get_more(self, paren_list=False):
         if paren_list and self.getc() == ')':



More information about the Pypy-commit mailing list