Skip to content

C assertion error from the runtime while expecting a SyntaxError #100050

Closed
@yilei

Description

@yilei

Crash report

In a --with-pydebug build, run the following code:

$ cat ~/tmp/t.py import ast ast.parse(""" func( a=["unclosed], # Need a quote in this comment: " b=2, ) """) $ ./python ~/tmp/t.py 

Error messages

python: Objects/call.c:324: _PyObject_Call: Assertion `!_PyErr_Occurred(tstate)' failed. fish: Job 1, './python ~/tmp/t.py' terminated by signal SIGABRT (Abort) 

(How do I obtain a core dump?)

I think the error happens inside this call:

raise_unclosed_parentheses_error(p);

What happened is that the _PyTokenizer_Get(p->tok, &new_token) call earlier also sets an error here.

Your environment

  • CPython versions tested on: main branch at 5c19050, but this also happens since Python 3.10
  • Operating system and architecture: Linux x86_64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions