[pypy-commit] pypy py3.6: fix test_flufl
rlamy
pypy.commits at gmail.com
Tue Nov 5 14:24:24 EST 2019
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r97962:fa561c2cb364
Date: 2019-11-05 19:23 +0000
http://bitbucket.org/pypy/pypy/changeset/fa561c2cb364/
Log: fix test_flufl
diff --git a/lib-python/3/test/test_flufl.py b/lib-python/3/test/test_flufl.py
--- a/lib-python/3/test/test_flufl.py
+++ b/lib-python/3/test/test_flufl.py
@@ -15,7 +15,7 @@
self.assertEqual(cm.exception.text, '2 != 3\n')
self.assertEqual(cm.exception.filename, '<FLUFL test>')
self.assertEqual(cm.exception.lineno, 2)
- self.assertEqual(cm.exception.offset, 4)
+ self.assertEqual(cm.exception.offset, 2) # changed in PyPy
def test_guido_as_bdfl(self):
code = '2 {0} 3'
@@ -26,7 +26,7 @@
self.assertEqual(cm.exception.text, '2 <> 3\n')
self.assertEqual(cm.exception.filename, '<FLUFL test>')
self.assertEqual(cm.exception.lineno, 1)
- self.assertEqual(cm.exception.offset, 4)
+ self.assertEqual(cm.exception.offset, 2) # changed in PyPy
if __name__ == '__main__':
diff --git a/pypy/interpreter/astcompiler/astbuilder.py b/pypy/interpreter/astcompiler/astbuilder.py
--- a/pypy/interpreter/astcompiler/astbuilder.py
+++ b/pypy/interpreter/astcompiler/astbuilder.py
@@ -497,10 +497,10 @@
def handle_async_funcdef(self, node, decorators=None):
return self.handle_funcdef_impl(node.get_child(1), 1, decorators)
-
+
def handle_funcdef(self, node, decorators=None):
return self.handle_funcdef_impl(node, 0, decorators)
-
+
def handle_async_stmt(self, node):
ch = node.get_child(1)
if ch.type == syms.funcdef:
@@ -942,7 +942,7 @@
if flufl and comp_node.get_value() == '!=':
self.error("with Barry as BDFL, use '<>' instead of '!='", comp_node)
elif not flufl and comp_node.get_value() == '<>':
- self.error('invalid comparison', comp_node)
+ self.error('invalid syntax', comp_node)
return ast.NotEq
elif comp_type == tokens.NAME:
if comp_node.get_value() == "is":
@@ -1014,7 +1014,7 @@
atom_node.get_column())
else:
return atom_expr
-
+
def handle_power(self, power_node):
atom_expr = self.handle_atom_expr(power_node.get_child(0))
if power_node.num_children() == 1:
@@ -1092,7 +1092,7 @@
def handle_call(self, args_node, callable_expr):
arg_count = 0 # position args + iterable args unpackings
keyword_count = 0 # keyword args + keyword args unpackings
- generator_count = 0
+ generator_count = 0
for i in range(args_node.num_children()):
argument = args_node.get_child(i)
if argument.type == syms.argument:
@@ -1300,7 +1300,6 @@
if is_dict:
raise self.error("dict unpacking cannot be used in "
"dict comprehension", atom_node)
-
return self.handle_dictcomp(maker, atom_node)
else:
# a dictionary display
@@ -1423,7 +1422,7 @@
comps = self.comprehension_helper(dict_maker.get_child(i))
return ast.DictComp(key, value, comps, atom_node.get_lineno(),
atom_node.get_column())
-
+
def handle_dictdisplay(self, node, atom_node):
keys = []
values = []
@@ -1435,7 +1434,7 @@
i += 1
return ast.Dict(keys, values, atom_node.get_lineno(),
atom_node.get_column())
-
+
def handle_setdisplay(self, node, atom_node):
elts = []
i = 0
More information about the pypy-commit
mailing list