Hi!
Thanks for the report! I fixed this in 179c172169f1.
Cheers,
Carl Friedrich
On 27/07/18 12:18, hubo wrote:
In PyPy 3.5, the following small piece of code cannot be imported, and
causes a SystemError:
def test(*a: lambda x: None):
pass
Stderr:
# pypy3 test.py
RPython traceback:
File "pypy_interpreter.c", line 33969, in BuiltinCode_funcrun_obj
File "pypy_module___builtin__.c", line 2705, in compile
File "pypy_interpreter.c", line 50963, in PythonAstCompiler__compile_ast
File "pypy_interpreter_astcompiler.c", line 1543, in compile_ast
File "pypy_interpreter_astcompiler.c", line 5995, in Module_walkabout
File "pypy_interpreter_astcompiler.c", line 13362, in
PythonCodeGenerator__handle_body
File "pypy_interpreter_astcompiler_2.c", line 20473, in
PythonCodeGenerator_visit_FunctionDef
File "pypy_interpreter_astcompiler_2.c", line 37632, in
_visit_function__FunctionCodeGenerator
File "pypy_interpreter_astcompiler_2.c", line 61299, in
_visit_annotations__pypy_interpreter_astcompiler_1
File "pypy_interpreter_astcompiler_3.c", line 8128, in
PythonCodeGenerator__visit_arg_annotation
File "pypy_interpreter_astcompiler_2.c", line 22498, in
PythonCodeGenerator_visit_Lambda
File "pypy_interpreter_astcompiler_2.c", line 35719, in
PythonCodeGenerator_sub_scope
File "pypy_interpreter_astcompiler.c", line 11371, in
PythonCodeGenerator___init__
SystemError: unexpected internal exception (please report a bug):
<KeyError object at 0x7efeb2749d20>; internal traceback was dumped to stderr
The crash appears when:
1. A varaible argument of a function has an annotation (like *args or
**kwargs, normal arguments are not affected), and
2. A lambda expression is used in the annotation
Both criterias must be met.
This cannot be reproduced on CPython3.5+. Also, Python document says:
Parameters may have annotations of the form “|:expression|”
following the parameter name. Any parameter may have an annotation
even those of the form|*identifier|or|**identifier|. Functions may
have “return” annotation of the form “|->expression|” after the
parameter list. These annotations can be any valid Python
expression. The presence of annotations does not change the
semantics of a function. The annotation values are available as
values of a dictionary keyed by the parameters’ names in
the|__annotations__|attribute of the function object.
Mutiple versions of PyPy 3.5 have this bug, including 5.8, 5.10 and 6.0
2018-07-27
------------------------------------------------------------------------
hubo
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev