Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
pypy
pypy
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 605
    • Issues 605
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 14
    • Merge Requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

This instance was upgraded to Heptapod 0.21.0 (final) today

  • PyPy
  • pypypypy
  • Issues
  • #3429

Closed
Open
Created Apr 07, 2021 by Saiyang Gou@gousaiyang

Nested function and class nonlocal usage triggers unexpected internal exception

The following code triggers an unexpected internal exception:

def foo():
    var = 0
    class A:
        def wrapper():
            nonlocal var
            var = 1
        wrapper()
        nonlocal var
    print(var)
foo()
RPython traceback:
  File "pypy_interpreter.c", line 37022, in BuiltinCode_funcrun_obj
  File "pypy_module___builtin__.c", line 3232, in compile
  File "pypy_interpreter.c", line 56391, in PythonAstCompiler__compile_ast
  File "pypy_interpreter_astcompiler.c", line 1679, in compile_ast
  File "implement_2.c", line 27470, in dispatcher_81
  File "pypy_interpreter_astcompiler.c", line 25013, in PythonCodeGenerator__handle_body
  File "pypy_interpreter_astcompiler_2.c", line 26304, in PythonCodeGenerator_visit_FunctionDef
  File "pypy_interpreter_astcompiler_2.c", line 46076, in _visit_function__FunctionCodeGenerator
  File "pypy_interpreter_astcompiler_2.c", line 44308, in PythonCodeGenerator_sub_scope
  File "pypy_interpreter_astcompiler_3.c", line 29114, in FunctionCodeGenerator__compile
  File "pypy_interpreter_astcompiler_2.c", line 22868, in PythonCodeGenerator_visit_ClassDef
  File "pypy_interpreter_astcompiler_2.c", line 44308, in PythonCodeGenerator_sub_scope
  File "pypy_interpreter_astcompiler_2.c", line 19627, in ClassCodeGenerator__compile
  File "pypy_interpreter_astcompiler.c", line 25013, in PythonCodeGenerator__handle_body
  File "pypy_interpreter_astcompiler_2.c", line 26304, in PythonCodeGenerator_visit_FunctionDef
  File "pypy_interpreter_astcompiler_2.c", line 46092, in _visit_function__FunctionCodeGenerator
  File "pypy_interpreter_astcompiler_2.c", line 45035, in PythonCodeGenerator__make_function
SystemError: unexpected internal exception (please report a bug): <KeyError object at 0x7f614c2f0da8>; internal traceback was dumped to stderr

Version info:

Python 3.7.9 (7e6e2bb30ac5, Nov 18 2020, 10:55:52)
[PyPy 7.3.3-beta0 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None