Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 668
    • Issues 668
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 14
    • Merge requests 14
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPy
  • pypypypy
  • Issues
  • #1963

Closed
Open
Created Jan 16, 2015 by Bitbucket Importer@bitbucket_importerMaintainer

Assertion failure in OptimizingVisitor.visit_Name

Created originally on Bitbucket by dwatola (Dave Watola)

Using version 2.4 of pypy, the very simple test case attached crashes with

#!

% pypy main.py
RPython traceback:
  File "pypy_interpreter_pycompiler.c", line 1567, in PythonAstCompiler__compile_ast
  File "pypy_interpreter_astcompiler_ast_1.c", line 20718, in Module_mutate_over
  File "pypy_interpreter_astcompiler_ast_2.c", line 10177, in ASTVisitor__mutate_sequence
  File "pypy_interpreter_astcompiler_ast_1.c", line 45287, in Assign_mutate_over
  File "pypy_interpreter_astcompiler_ast_2.c", line 10177, in ASTVisitor__mutate_sequence
  File "pypy_interpreter_astcompiler_ast_1.c", line 53781, in List_mutate_over
  File "pypy_interpreter_astcompiler_ast_2.c", line 10177, in ASTVisitor__mutate_sequence
  File "pypy_interpreter_astcompiler_optimize.c", line 252, in OptimizingVisitor_visit_Name
Fatal RPython error: AssertionError
Abort (core dumped)

This test case uses macropy, which adjusts AST representation using an import hook. The crash occurs during compilation -- there is no runtime code in this case. Aside from this issue, macropy seems to work correctly with pypy. All seems well with the proposed fix below.

It is not clear what is triggering this optimization, because the original and final ASTs involved do not use "None", I was able to eliminate the problem by editing OptimizingVisitor.visit_Name in pypy/interpreter/astcompiler/optimize.py and changing the guard condition on the "if" statement to include the assertion condition would provide a correct solution. i.e.

#!python

  if name.id=="None" and name.ctx ==ast.Load

(and then eliminate the assertion).

This appears to be a safe and correct change, but I have no familiarity with the pypy code base and thought that someone else should evaluate the situation.

Attachments: testcase.tar.gz

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking