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

Simplify string tokenization regexes #4331

Merged
merged 5 commits into from Apr 25, 2024
Merged

Conversation

JelleZijlstra
Copy link
Collaborator

Fixes #4330

I found that the repro case from #4330 was hanging in applying some of the regexes used in tokenization. These regexes have a few inefficient features:

  • Nested and adjacent groups instead of a single level; this leads to backtracking
  • Some of the groups for "normal" characters were missing an exclusion for backslash, which was also leading to backtracking.

Copy link

diff-shades reports zero changes comparing this PR (315ea67) to main (5683242).


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

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

where's the cve at

@hauntsaninja hauntsaninja merged commit ba88fc3 into psf:main Apr 25, 2024
46 checks passed
@JelleZijlstra JelleZijlstra deleted the 2441 branch April 25, 2024 06:26
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 24.4.1 hangs with python 3.10.12
3 participants