[Python-Dev] Time for 2.3.3?

Barry Warsaw barry at python.org
Fri Nov 21 14:36:06 EST 2003


On Fri, 2003-11-21 at 14:22, Tim Peters wrote:

> block (which is in turn nested in a !defined(USE_STACKCHECK) block, which is
> in turn nested in an ifndef SRE_RECURSIVE block).  God only knows what the
> intent was.  But I expect that, yes, USE_RECURSION_LIMIT isn't getting
> defined on anything other than FreeBSD and Win64.

Yep, you're right.  If I hack _sre.c with the patch below, I think I get
something closer to what we expect to see.

% ./python
Python 2.3.3a0 (#5, Nov 21 2003, 14:26:25) 
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _sre
[24583 refs]
>>> _sre.RECURSION_LIMIT
10000
[24585 refs]
>>> 
[24585 refs]
[7130 refs]

...

======================================================================
ERROR: test_bug_418626 (__main__.ReTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_re.py", line 410, in test_bug_418626
    self.assertEqual(re.search('(a|b)*?c', 10000*'ab'+'cd').end(0), 20001)
  File "/home/barry/projects/python23/Lib/sre.py", line 137, in search
    return _compile(pattern, flags).search(string)
RuntimeError: maximum recursion limit exceeded

======================================================================
ERROR: test_stack_overflow (__main__.ReTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_re.py", line 420, in test_stack_overflow
    self.assertEqual(re.match('(x)*', 50000*'x').group(1), 'x')
  File "/home/barry/projects/python23/Lib/sre.py", line 132, in match
    return _compile(pattern, flags).match(string)
RuntimeError: maximum recursion limit exceeded

I'll leave it to someone else to check in the proper fix.  (But does
anybody else like exposing RECURSION_LIMIT in the _sre module?)

-Barry


-------------- next part --------------
A non-text attachment was scrubbed...
Name: sre-patch2.txt
Type: text/x-patch
Size: 825 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20031121/86e2a559/sre-patch2.bin


More information about the Python-Dev mailing list