homepage

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.

classification
Title: RuntimeError raised with re.search + re.DOTALL on empty string
Type: behavior Stage: resolved
Components: Regular Expressions Versions: Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: internal error in regular expression engine
View: 17998
Assigned To: Nosy List: ezio.melotti, hbock, mrabarnett, serhiy.storchaka
Priority: normal Keywords:

Created on 2013年06月11日 14:40 by hbock, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (3)
msg190966 - (view) Author: Harry Bock (hbock) Date: 2013年06月11日 14:40
In Python 2.7.5, running re.search on regular expressions beginning with '.+' will raise RuntimeError if:
 * the string being matched is empty
 * the flags include re.DOTALL/re.S
>>> re.search(".+a", "", flags=re.S)
 File "C:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 2731, in run_code
 exec code_obj in self.user_global_ns, self.user_ns
 File "<ipython-input-16-fefa32a418ba>", line 1, in <module>
 myre.search("")
RuntimeError: internal error in regular expression engine
This does not occur if the input string is not empty, or if re.match is used instead of re.search, or if the re.S flag is omitted.
The bug does not occur on previous versions of Python 2.x, including 2.7.4.
msg190974 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2013年06月11日 16:16
Also in Python 3.3.2, but not Python 3.2.
I haven't tested Python 3.3.1 or Python 3.3.0.
msg190978 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013年06月11日 17:49
Thank you for your report. This is a duplicate of issue17998.
History
Date User Action Args
2022年04月11日 14:57:46adminsetgithub: 62390
2013年06月11日 17:49:53serhiy.storchakasetstatus: open -> closed

superseder: internal error in regular expression engine

nosy: + serhiy.storchaka
messages: + msg190978
resolution: duplicate
stage: resolved
2013年06月11日 16:16:27mrabarnettsetmessages: + msg190974
versions: + Python 3.3
2013年06月11日 14:40:35hbockcreate

AltStyle によって変換されたページ (->オリジナル) /