Skip to content

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

Closed
BHUVANSH855 wants to merge 2 commits into
python:mainfrom
BHUVANSH855:fix-153304-pegen-assert
Closed

BHUVANSH855 wants to merge 2 commits into
python:mainfrom
BHUVANSH855:fix-153304-pegen-assert

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

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.

@BHUVANSH855

Copy link
Copy Markdown
Contributor Author

Closing this PR, as after merging the main the changes made by me were gone, i.e. its already fixed on main by someone.

@BHUVANSH855 BHUVANSH855 closed this Oct 5, 2026
@BHUVANSH855
BHUVANSH855 deleted the fix-153304-pegen-assert branch October 5, 2026 06:23
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