Issue 14342: In re's examples the example with recursion doesn't work (original) (raw)

Issue14342

Created on 2012-03-17 00:48 by py.user, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg156112 - (view) Author: py.user (py.user) * Date: 2012-03-17 00:48
http://docs.python.org/py3k/library/re.html#avoiding-recursion >>> import sys >>> sys.getrecursionlimit() 1000 >>> import re >>> s = 'Begin ' + 1000*'a very long string ' + 'end' >>> re.match('Begin (\w| )*? end', s).end() 19009 >>>
msg156126 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2012-03-17 02:41
As far as I can tell, back in 2003, changes were made to replace the recursive scheme which used stack allocation with a non-recursive scheme which used heap allocation in order to the improve the behaviour. To me it looks like an oversight and that the example should have been removed at the time, but unfortunately was retained and just updated in subsequent releases to refer to the Python version ("python3.2" in this case).
msg156169 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-17 16:26
New changeset 8172d7dce0ed by Georg Brandl in branch '3.2': Closes #14342: remove out-of-date section about avoiding recursion errors. http://hg.python.org/cpython/rev/8172d7dce0ed
msg156171 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-17 16:27
New changeset 276f79e4b215 by Georg Brandl in branch '2.7': Closes #14342: remove out-of-date section about avoiding recursion errors. http://hg.python.org/cpython/rev/276f79e4b215
History
Date User Action Args
2022-04-11 14:57:28 admin set github: 58550
2012-03-17 16:27:47 python-dev set messages: +
2012-03-17 16:26:40 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2012-03-17 02:41:19 mrabarnett set messages: +
2012-03-17 00:48:27 py.user create