Crash report
What happened?
Found by OSS Fuzz in 491369109.
When running the below reproducer with the PyCF_IGNORE_COOKIE and PyCF_TYPE_COMMENTS flags, you get:
>>> a=1 #type: \x80
python: Python/ast.c:1051: _PyAST_Validate: Assertion `!PyErr_Occurred()' failed.
Fatal Python error: Aborted
This occurs because NEW_TYPE_COMMENT() sets p->error_indicator and returns NULL (_PyPegen_new_type_comment() fails on decoding, and returns NULL). However since the field is optional, parsing succeeds. Our current error check does not account for this case.
I will send a patch shortly.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Linked PRs
Crash report
What happened?
Found by OSS Fuzz in 491369109.
When running the below reproducer with the
PyCF_IGNORE_COOKIEandPyCF_TYPE_COMMENTSflags, you get:This occurs because
NEW_TYPE_COMMENT()setsp->error_indicatorand returnsNULL(_PyPegen_new_type_comment()fails on decoding, and returnsNULL). However since the field is optional, parsing succeeds. Our current error check does not account for this case.I will send a patch shortly.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Output from running 'python -VV' on the command line:
No response
Linked PRs
NEW_TYPE_COMMENT#145784NEW_TYPE_COMMENT(GH-145784) #145926NEW_TYPE_COMMENT(GH-145784) #145927