[pypy-commit] pypy py3.6: hg merge py3.5
rlamy
pypy.commits at gmail.com
Sat Jul 28 21:07:05 EDT 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.6
Changeset: r94922:326720df4fbe
Date: 2018-07-29 02:06 +0100
http://bitbucket.org/pypy/pypy/changeset/326720df4fbe/
Log: hg merge py3.5
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
@@ -379,8 +379,8 @@
names)
self._visit_arg_annotations(args.kwonlyargs, names)
kwarg = args.kwarg
- if args.kwarg:
- self._visit_arg_annotation(args.kwarg.arg, args.kwarg.annotation,
+ if kwarg:
+ self._visit_arg_annotation(kwarg.arg, kwarg.annotation,
names)
self._visit_arg_annotation("return", returns, names)
l = len(names)
diff --git a/pypy/interpreter/astcompiler/symtable.py b/pypy/interpreter/astcompiler/symtable.py
--- a/pypy/interpreter/astcompiler/symtable.py
+++ b/pypy/interpreter/astcompiler/symtable.py
@@ -640,6 +640,10 @@
assert isinstance(args, ast.arguments)
if args.args:
self._visit_arg_annotations(args.args)
+ if args.vararg:
+ self._visit_arg_annotation(args.vararg)
+ if args.kwarg:
+ self._visit_arg_annotation(args.kwarg)
if args.kwonlyargs:
self._visit_arg_annotations(args.kwonlyargs)
if func.returns:
@@ -648,8 +652,11 @@
def _visit_arg_annotations(self, args):
for arg in args:
assert isinstance(arg, ast.arg)
- if arg.annotation:
- arg.annotation.walkabout(self)
+ self._visit_arg_annotation(arg)
+
+ def _visit_arg_annotation(self, arg):
+ if arg.annotation:
+ arg.annotation.walkabout(self)
def visit_Name(self, name):
if name.ctx == ast.Load:
diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py
--- a/pypy/interpreter/test/test_app_main.py
+++ b/pypy/interpreter/test/test_app_main.py
@@ -470,7 +470,7 @@
def test_cmd_co_name(self):
child = self.spawn(['-c',
- 'import sys; print sys._getframe(0).f_code.co_name'])
+ 'import sys; print(sys._getframe(0).f_code.co_name)'])
child.expect('<module>')
def test_ignore_python_inspect(self):
diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py
--- a/pypy/interpreter/test/test_executioncontext.py
+++ b/pypy/interpreter/test/test_executioncontext.py
@@ -149,7 +149,7 @@
pass
""")
space.getexecutioncontext().setllprofile(None, None)
- assert l == ['call', 'return', 'call', 'return']
+ assert l[-4:] == ['call', 'return', 'call', 'return']
def test_llprofile_c_call(self):
from pypy.interpreter.function import Function, Method
@@ -173,15 +173,15 @@
return
""" % snippet)
space.getexecutioncontext().setllprofile(None, None)
- assert l == ['call', 'return', 'call', 'c_call', 'c_return', 'return']
- if isinstance(seen[0], Method):
- w_class = space.type(seen[0].w_instance)
+ assert l[-6:] == ['call', 'return', 'call', 'c_call', 'c_return', 'return']
+ if isinstance(seen[-1], Method):
+ w_class = space.type(seen[-1].w_instance)
found = 'method %s of %s' % (
- seen[0].w_function.name,
+ seen[-1].w_function.name,
w_class.getname(space).encode('utf-8'))
else:
- assert isinstance(seen[0], Function)
- found = 'builtin %s' % seen[0].name
+ assert isinstance(seen[-1], Function)
+ found = 'builtin %s' % seen[-1].name
assert found == expected_c_call
check_snippet('l = []; l.append(42)', 'method append of list')
@@ -210,7 +210,7 @@
return
""" % snippet)
space.getexecutioncontext().setllprofile(None, None)
- assert l == ['call', 'return', 'call', 'c_call', 'c_exception', 'return']
+ assert l[-6:] == ['call', 'return', 'call', 'c_call', 'c_exception', 'return']
check_snippet('d = {}; d.__getitem__(42)')
diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -153,6 +153,8 @@
r"""
seen = []
def tracer(f, event, *args):
+ if f.f_code.co_name == "decode":
+ return tracer
seen.append((event, f.f_lineno))
if len(seen) == 5:
f.f_lineno = 1 # bug shown only when setting lineno to 1
@@ -297,7 +299,8 @@
l = []
def trace(a,b,c):
- l.append((a,b,c))
+ if a.f_code.co_name != "decode":
+ l.append((a,b,c))
def f():
h = _testing.Hidden()
diff --git a/pypy/interpreter/test/test_syntax.py b/pypy/interpreter/test/test_syntax.py
--- a/pypy/interpreter/test/test_syntax.py
+++ b/pypy/interpreter/test/test_syntax.py
@@ -689,6 +689,16 @@
"bye" : 5, "kw" : 6, "return" : 42}
"""
+ def test_bug_annotations_lambda(self):
+ """
+ # those used to crash
+ def broken(*a: lambda x: None):
+ pass
+
+ def broken(**a: lambda x: None):
+ pass
+ """
+
class AppTestSyntaxError:
def test_tokenizer_error_location(self):
More information about the pypy-commit
mailing list