Skip to content

Avoid a normalizer crash after standalone line continuations - #252

Closed
rupayon123 wants to merge 1 commit into
davidhalter:masterfrom
rupayon123:fix/comment-after-line-continuation-219
Closed

rupayon123 wants to merge 1 commit into
davidhalter:masterfrom
rupayon123:fix/comment-after-line-continuation-219

Conversation

@rupayon123

Copy link
Copy Markdown

A source file containing a standalone line continuation followed by a comment crashes the normalizer with AttributeError instead of returning diagnostics.

The continuation prefix creates an indentation node that may not occur in the previous indentation stack. Stop the comment walk at the root in that case. Also refresh the local node after a continuation is popped, so a trailing newline does not get an incorrect indentation warning.

Closes #219.

Validation on Python 3.12.13:

  • The 18 new cases failed before the repair. They cover both EOF endings across the supported 3.6–3.14 grammar versions; the assertions check the expected diagnostic codes.
  • Full test suite: 2,007 passed.
  • Flake8 5.0.4 with the repository's CI command: passed.
  • Zuban 0.5.1: no issues in 49 source files.
  • git diff --check: passed.

Other Python runtime versions have not been run locally; grammar-version coverage is not the same as the CI runtime matrix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught exception in get_normalizer_issues

2 participants