Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r89714:f8438a882d93
Date: 2017-01-24 00:29 +0000
http://bitbucket.org/pypy/pypy/changeset/f8438a882d93/
Log: The attribute of NameConstant must be named 'value'
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
@@ -2678,8 +2678,8 @@
class NameConstant(expr):
- def __init__(self, single, lineno, col_offset):
- self.single = single
+ def __init__(self, value, lineno, col_offset):
+ self.value = value
expr.__init__(self, lineno, col_offset)
def walkabout(self, visitor):
@@ -2690,8 +2690,8 @@
def to_object(self, space):
w_node = space.call_function(get(space).w_NameConstant)
- w_single = self.single # singleton
- space.setattr(w_node, space.wrap('single'), w_single)
+ w_value = self.value # singleton
+ space.setattr(w_node, space.wrap('value'), w_value)
w_lineno = space.wrap(self.lineno) # int
space.setattr(w_node, space.wrap('lineno'), w_lineno)
w_col_offset = space.wrap(self.col_offset) # int
@@ -2700,17 +2700,17 @@
@staticmethod
def from_object(space, w_node):
- w_single = get_field(space, w_node, 'single', False)
+ w_value = get_field(space, w_node, 'value', False)
w_lineno = get_field(space, w_node, 'lineno', False)
w_col_offset = get_field(space, w_node, 'col_offset', False)
- _single = w_single
- if _single is None:
- raise_required_value(space, w_node, 'single')
+ _value = w_value
+ if _value is None:
+ raise_required_value(space, w_node, 'value')
_lineno = space.int_w(w_lineno)
_col_offset = space.int_w(w_col_offset)
- return NameConstant(_single, _lineno, _col_offset)
-
-State.ast_type('NameConstant', 'expr', ['single'])
+ return NameConstant(_value, _lineno, _col_offset)
+
+State.ast_type('NameConstant', 'expr', ['value'])
class Ellipsis(expr):
diff --git a/pypy/interpreter/astcompiler/codegen.py
b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -1246,7 +1246,7 @@
def visit_NameConstant(self, node):
self.update_position(node.lineno)
- self.load_const(node.single)
+ self.load_const(node.value)
def visit_keyword(self, keyword):
if keyword.arg is not None:
diff --git a/pypy/interpreter/astcompiler/optimize.py
b/pypy/interpreter/astcompiler/optimize.py
--- a/pypy/interpreter/astcompiler/optimize.py
+++ b/pypy/interpreter/astcompiler/optimize.py
@@ -71,7 +71,7 @@
class __extend__(ast.NameConstant):
def as_constant(self):
- return self.single
+ return self.value
class __extend__(ast.Index):
def as_constant(self):
diff --git a/pypy/interpreter/astcompiler/tools/Python.asdl
b/pypy/interpreter/astcompiler/tools/Python.asdl
--- a/pypy/interpreter/astcompiler/tools/Python.asdl
+++ b/pypy/interpreter/astcompiler/tools/Python.asdl
@@ -71,8 +71,7 @@
| Num(object n) -- a number as a PyObject.
| Str(string s) -- need to specify raw, unicode, etc?
| Bytes(bytes s)
- -- PyPy mod. first argument name must not be value
- | NameConstant(singleton single)
+ | NameConstant(singleton value)
| Ellipsis
-- the following expression can appear in assignment context
diff --git a/pypy/interpreter/astcompiler/validate.py
b/pypy/interpreter/astcompiler/validate.py
--- a/pypy/interpreter/astcompiler/validate.py
+++ b/pypy/interpreter/astcompiler/validate.py
@@ -444,7 +444,7 @@
def visit_NameConstant(self, node):
space = self.space
- if (node.single is not space.w_None and
- node.single is not space.w_True and
- node.single is not space.w_False):
+ if (node.value is not space.w_None and
+ node.value is not space.w_True and
+ node.value is not space.w_False):
raise ValidationError("singleton must be True, False, or None")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit