Skip to content

Conversation

@Nikhil172913832
Copy link
Contributor

@Nikhil172913832 Nikhil172913832 commented Dec 7, 2025

Description

Closes #4880

This PR fixes issue #4880 by ensuring that Black does not omit optional parentheses when doing so would merge a # type: ignore comment with other comments on the same line. Merging these comments causes Python's AST parser to lose the TypeIgnore node, resulting in AST equivalence failures and internal errors. The pr updates the logic in can_omit_invisible_parens() to detect and prevent this specific case.

Checklist - did you ...

  • Implement any code style changes under the --preview style, following the stability policy?
  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

diff-shades reports zero changes comparing this PR (e3eb52e) to main (2fd75b0).


What is this? | Workflow run | diff-shades documentation

@Nikhil172913832
Copy link
Contributor Author

I am examining the diff shades and will look for a way to avoid the unnecessary changes.

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.

Failure upon two ignores for type checkers

1 participant