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 bug which causes f-expressions to be split #1809

Merged
merged 1 commit into from Nov 7, 2020

Conversation

bbugyi200
Copy link
Contributor

@bbugyi200 bbugyi200 commented Nov 6, 2020

This fix makes use of the regex library's ability to specify "recursive patterns" to correctly match f-expressions which contain other f-expressions.

Closes #1807.

Copy link
Collaborator

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can't say I fully understand how that regex works.

@bbugyi200
Copy link
Contributor Author

bbugyi200 commented Nov 6, 2020

Thanks! Can't say I fully understand how that regex works.

That's probably a good indication that a regex should not be used. ¯\(ツ)

I can write a full-fledged f-expression parser if we keep getting crashes like this, but I'm fairly confident that this new regex should cover all cases (i.e. match all possible f-expressions).

@JelleZijlstra JelleZijlstra merged commit edf1c9d into psf:master Nov 7, 2020
noxan pushed a commit to noxan/black that referenced this pull request Jun 6, 2021
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.

Black produced invalid code: invalid syntax with --experimental-string-processing
2 participants