Skip to content

gh-153304: Remove incorrect assertion in pegen error handling#153833

Open
BHUVANSH855 wants to merge 1 commit into
python:mainfrom
BHUVANSH855:fix-153304-pegen-assert
Open

gh-153304: Remove incorrect assertion in pegen error handling#153833
BHUVANSH855 wants to merge 1 commit into
python:mainfrom
BHUVANSH855:fix-153304-pegen-assert

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Remove an assertion in _PyPegen_raise_error_known_location() that can abort debug builds before the existing fallback logic handles the error.

When _PyErr_ProgramDecodedTextObject() cannot reopen the source file, it may return NULL. The code immediately following the assertion already handles this case, so the assertion prevents the intended fallback from executing.

Testing

  • Reproduced the assertion failure on a Linux --with-pydebug build using the reproducer from the issue.
  • Verified that after removing the assertion, the reproducer reports a normal SyntaxError instead of aborting.
  • Built CPython successfully on both Linux (--with-pydebug) and Windows Debug builds.

@bedevere-app

bedevere-app Bot commented Jul 17, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant