Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash in preview style with assert + parenthesized string. #3415

Merged
merged 2 commits into from Dec 10, 2022

Conversation

yilei
Copy link
Contributor

@yilei yilei commented Dec 10, 2022

Description

The bug is in the get_leaves_inside_matching_brackets on the third line below:

assert xxxxxxxxx.xxxxxxxxx.xxxxxxxxx(
    xxxxxxxxx
).xxxxxxxxxxxxxxxxxx(), (
    "xxx {xxxxxxxxx} xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)

Including the invisible paren, third line is ).xxxxxxxxxxxxxxxxxx()), (, that it has a matched pair then an unmatched closing paren afterwards. This PR ensures the returned leaves are actually matched.

Fixes #3414.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@yilei
Copy link
Contributor Author

yilei commented Dec 10, 2022

diff-shades failed (unrelatedly) on mypyc compiling black/__init__.py? https://github.com/psf/black/actions/runs/3663181139/jobs/6192793818#step:6:56

@JelleZijlstra
Copy link
Collaborator

Thanks for the fix! #3416 should fix the mypyc issue, let me update the branch for this PR.

@github-actions
Copy link

diff-shades reports zero changes comparing this PR (04bb8d2) to main (1f7f6de).


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

@JelleZijlstra JelleZijlstra merged commit 96e62c5 into psf:main Dec 10, 2022
@yilei yilei deleted the parencrash branch December 11, 2022 05:16
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.

Crash in preview style with assert + parenthesized string
2 participants