Internal error when annotated class variable has same name than local variable
Pypy version:
Python 3.6.9 (?, Apr 18 2020, 02:46:07)
[PyPy 7.3.1 with GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.59)] on darwin
Minimal example to reproduce:
def func():
bar = None
class Foo:
bar: int = 0 # removing type annotation make the error disappear
def get_bar(self):
return bar
Traceback:
RPython traceback:
File "pypy_interpreter.c", line 37239, in BuiltinCode_funcrun_obj
File "pypy_module___builtin__.c", line 2951, in compile
File "pypy_interpreter.c", line 56683, in PythonAstCompiler__compile_ast
File "pypy_interpreter_astcompiler.c", line 1574, in compile_ast
File "implement_2.c", line 27063, in dispatcher_86
File "pypy_interpreter_astcompiler.c", line 24925, in PythonCodeGenerator__handle_body
File "pypy_interpreter_astcompiler_2.c", line 22534, in PythonCodeGenerator_visit_FunctionDef
File "pypy_interpreter_astcompiler_2.c", line 41494, in _visit_function__FunctionCodeGenerator
File "pypy_interpreter_astcompiler_2.c", line 39257, in PythonCodeGenerator_sub_scope
File "pypy_interpreter_astcompiler_3.c", line 19865, in FunctionCodeGenerator__compile
File "pypy_interpreter_astcompiler_2.c", line 22254, in PythonCodeGenerator_visit_ClassDef
File "pypy_interpreter_astcompiler_2.c", line 39257, in PythonCodeGenerator_sub_scope
File "pypy_interpreter_astcompiler_2.c", line 19829, in ClassCodeGenerator__compile
File "pypy_interpreter_astcompiler.c", line 24925, in PythonCodeGenerator__handle_body
File "pypy_interpreter_astcompiler_2.c", line 22534, in PythonCodeGenerator_visit_FunctionDef
File "pypy_interpreter_astcompiler_2.c", line 41510, in _visit_function__FunctionCodeGenerator
File "pypy_interpreter_astcompiler_2.c", line 39984, in PythonCodeGenerator__make_function
SystemError: unexpected internal exception (please report a bug): <KeyError object at 0x107fcf010>; internal traceback was dumped to stderr
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information