This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年11月07日 17:00 by Sebastien.Estienne, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| re_bug.py | Sebastien.Estienne, 2012年11月07日 17:00 | Example of the bug | ||
| Messages (3) | |||
|---|---|---|---|
| msg175109 - (view) | Author: Sebastien Estienne (Sebastien.Estienne) | Date: 2012年11月07日 17:00 | |
Hello re.match is blocked and takes 100% cpu forever re_bug.py is an example of the bug. thanx |
|||
| msg175111 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年11月07日 17:34 | |
There is no a Python bug. You have wrong regexp. Remove "$" at the end or add ".*" before "$". And it would be better if instead of '(?P<date>.*?)\s' and '"(?P<method_uri>.*?)"' you use '(?P<date>\S+)\s' and '"(?P<method_uri>[^"]*)"'. |
|||
| msg175112 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年11月07日 17:35 | |
This is a known issue: there are a good few duplicates in the tracker. Issue #1662581 is one, for example. In this particular case, you can probably fix things by tightening up your regex. Part of the problem is that '.*' is going to match any sequence of characters, including spaces. Judicious use of '\S' to match non-whitespace characters might help. There's not much point to the '?' in '.*?', either. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:38 | admin | set | github: 60634 |
| 2012年11月07日 17:35:54 | mark.dickinson | set | superseder: the re module can perform poorly: O(2**n) versus O(n**2) messages: + msg175112 nosy: + mark.dickinson |
| 2012年11月07日 17:34:32 | serhiy.storchaka | set | status: open -> closed nosy: + serhiy.storchaka messages: + msg175111 resolution: not a bug stage: resolved |
| 2012年11月07日 17:00:35 | Sebastien.Estienne | create | |