Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-146333: Fix quadratic regex backtracking in configparser option parsing#146399

Open
joshuaswanson wants to merge 1 commit intopython:mainfrom
joshuaswanson:fix/configparser-regex-backtracking
Open

gh-146333: Fix quadratic regex backtracking in configparser option parsing#146399
joshuaswanson wants to merge 1 commit intopython:mainfrom
joshuaswanson:fix/configparser-regex-backtracking

Conversation

@joshuaswanson
Copy link

@joshuaswansonjoshuaswanson commentedMar 25, 2026
edited by bedevere-appbot
Loading

The_OPT_TMPL and_OPT_NV_TMPL regexes have quadratic backtracking when a line contains many spaces between non-delimiter characters. The lazy.*? in the option group and the\s* before the delimiter overlap on whitespace, so the engine tries every possible split point.

The fix removes\s* before the delimiter. This is safe because the option name is already stripped via.rstrip() in_handle_option (line 1160), and the value is stripped via.strip() (line 1169).

Before:x + 40000 spaces +y takes ~86 seconds
After: ~0.004 seconds

@python-cla-bot
Copy link

python-cla-botbot commentedMar 25, 2026
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@joshuaswansonjoshuaswansonforce-pushed thefix/configparser-regex-backtracking branch from12c55b1 tofe7efdaCompareMarch 25, 2026 00:19
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jaracojaracoAwaiting requested review from jaracojaraco is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@joshuaswanson

[8]ページ先頭

©2009-2026 Movatter.jp