[pypy-svn] r66264 - in pypy/branch/parser-compiler/pypy/interpreter/astcompiler: . test

benjamin at codespeak.net benjamin at codespeak.net
Thu Jul 16 00:40:17 CEST 2009


Author: benjamin
Date: Thu Jul 16 00:40:16 2009
New Revision: 66264

Modified:
   pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
   pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py
Log:
ugh. implementation details of temporary names

Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py	Thu Jul 16 00:40:16 2009
@@ -273,7 +273,7 @@
         self.scopes = {}
         self.scope = None
         self.stack = []
-        self.tmp_name_counter = 0
+        self.tmp_name_counter = 1
         top = ModuleScope(module)
         self.globs = top.roles
         self.push_scope(top)

Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py	Thu Jul 16 00:40:16 2009
@@ -320,13 +320,13 @@
 
     def test_tmpnames(self):
         scp = self.mod_scope("[x for x in y]")
-        assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
+        assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
         scp = self.mod_scope("with x: pass")
-        assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
+        assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
         scp = self.mod_scope("with x as y: pass")
-        assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
         assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
+        assert scp.lookup("_[2]") == symtable.SCOPE_LOCAL
         # Just in case.
         scp = self.mod_scope("with [x for y in z]: pass")
-        assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
         assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
+        assert scp.lookup("_[2]") == symtable.SCOPE_LOCAL



More information about the Pypy-commit mailing list