Skip to content

Conversation

@tusharsadhwani
Copy link
Collaborator

@tusharsadhwani tusharsadhwani commented Jul 31, 2024

Description

Tiny inconsistency between two regexes, one had a part changed to \\[^{] whereas the other was left to be \\., causing a crash in parsing in some cases.

The regex was a bit unreasonably complex though, it doesn't need to have \\. or \\[^{] in it anyway. This simplifies the regex and makes it more compatible.

Resolves #4421

@JelleZijlstra
Copy link
Collaborator

Thanks! Could you add a changelog entry since this fixes crashes on some real-world code?

Also might be worth adding a few more test cases; I'll take a look tonight and maybe push some too.

@tusharsadhwani
Copy link
Collaborator Author

This fixes the two crashing cases, but doesn't fix the incorrect parses.

Still looking into that one.

@tusharsadhwani
Copy link
Collaborator Author

rf"\{"a"}" is not fixed yet, rf"\{2}" still parses wrong.

@github-actions
Copy link

github-actions bot commented Jul 31, 2024

diff-shades reports zero changes comparing this PR (b32f69f) to main (4b4ae43).


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

@JelleZijlstra
Copy link
Collaborator

I have a fix for the remaining cases locally, will put up a PR once #4423 is done.

@tusharsadhwani
Copy link
Collaborator Author

@JelleZijlstra I just made a fix, see if you can find any bugs with this one?

@JelleZijlstra JelleZijlstra merged commit b1c4dd9 into psf:main Aug 2, 2024
@tusharsadhwani tusharsadhwani deleted the fstring-bugfix branch August 2, 2024 18:19
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 on f-string with \{

2 participants