Skip to content

Segfault when compiling a nested AST #4862

@xiaxinmeng

Description

@xiaxinmeng

The code creates a nested abstract syntax tree for a double negation operation using the ast module and compiles and evaluates it, resulting in a segmentation fault.

import ast
d = e = ast.UnaryOp(op=ast.Not(), lineno=0, col_offset=0)
d.operand = e
compile(ast.Expression(d), "<test>", "eval")

Crash message:
Segmentation fault (core dumped)

Environment:
Ubuntu 18.04
rustpython v0.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compilerArea: compilerC-bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions