Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r57239:665ddfc5d708
Date: 2012-09-07 23:56 +0200
http://bitbucket.org/pypy/pypy/changeset/665ddfc5d708/

Log:    Fixes in the ast module, after branch merge.

diff --git a/pypy/interpreter/astcompiler/ast.py 
b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -971,7 +971,7 @@
         if w_list is not None:
             list_w = space.listview(w_list)
             if list_w:
-                self.names = [space.realstr_w(w_obj) for w_obj in list_w]
+                self.names = [space.identifier_w(w_obj) for w_obj in list_w]
             else:
                 self.names = None
 
@@ -999,7 +999,7 @@
         if w_list is not None:
             list_w = space.listview(w_list)
             if list_w:
-                self.names = [space.realstr_w(w_obj) for w_obj in list_w]
+                self.names = [space.identifier_w(w_obj) for w_obj in list_w]
             else:
                 self.names = None
 
@@ -3103,7 +3103,7 @@
 
 def FunctionDef_set_name(space, w_self, w_new_value):
     try:
-        w_self.name = space.realstr_w(w_new_value)
+        w_self.name = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -3235,7 +3235,7 @@
 
 def ClassDef_set_name(space, w_self, w_new_value):
     try:
-        w_self.name = space.realstr_w(w_new_value)
+        w_self.name = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -4369,7 +4369,7 @@
         if space.is_w(w_new_value, space.w_None):
             w_self.module = None
         else:
-            w_self.module = space.realstr_w(w_new_value)
+            w_self.module = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -5945,7 +5945,7 @@
 
 def Attribute_set_attr(space, w_self, w_new_value):
     try:
-        w_self.attr = space.realstr_w(w_new_value)
+        w_self.attr = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -6188,7 +6188,7 @@
 
 def Name_set_id(space, w_self, w_new_value):
     try:
-        w_self.id = space.realstr_w(w_new_value)
+        w_self.id = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7079,7 +7079,7 @@
         if space.is_w(w_new_value, space.w_None):
             w_self.name = None
         else:
-            w_self.name = space.realstr_w(w_new_value)
+            w_self.name = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7165,7 +7165,7 @@
         if space.is_w(w_new_value, space.w_None):
             w_self.vararg = None
         else:
-            w_self.vararg = space.realstr_w(w_new_value)
+            w_self.vararg = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7231,7 +7231,7 @@
         if space.is_w(w_new_value, space.w_None):
             w_self.kwarg = None
         else:
-            w_self.kwarg = space.realstr_w(w_new_value)
+            w_self.kwarg = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7346,7 +7346,7 @@
 
 def arg_set_arg(space, w_self, w_new_value):
     try:
-        w_self.arg = space.realstr_w(w_new_value)
+        w_self.arg = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7417,7 +7417,7 @@
 
 def keyword_set_arg(space, w_self, w_new_value):
     try:
-        w_self.arg = space.realstr_w(w_new_value)
+        w_self.arg = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7488,7 +7488,7 @@
 
 def alias_set_name(space, w_self, w_new_value):
     try:
-        w_self.name = space.realstr_w(w_new_value)
+        w_self.name = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
@@ -7513,7 +7513,7 @@
         if space.is_w(w_new_value, space.w_None):
             w_self.asname = None
         else:
-            w_self.asname = space.realstr_w(w_new_value)
+            w_self.asname = space.identifier_w(w_new_value)
     except OperationError, e:
         if not e.match(space, space.w_TypeError):
             raise
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py 
b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -295,7 +295,7 @@
     "object" : "%s",
     "int" : "space.int_w(%s)",
     "string": "check_string(space, %s)",
-    "identifier" : "space.realstr_w(%s)",
+    "identifier" : "space.identifier_w(%s)",
     "bool" : "space.bool_w(%s)"
 }
 
diff --git a/pypy/module/_ast/test/test_ast.py 
b/pypy/module/_ast/test/test_ast.py
--- a/pypy/module/_ast/test/test_ast.py
+++ b/pypy/module/_ast/test/test_ast.py
@@ -290,7 +290,7 @@
 
     def test_invalid_identitifer(self):
         import ast
-        m = ast.Module([ast.Expr(ast.Name(u"x", ast.Load()))])
+        m = ast.Module([ast.Expr(ast.Name(b"x", ast.Load()))])
         ast.fix_missing_locations(m)
         exc = raises(TypeError, compile, m, "<test>", "exec")
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to