[Python-Dev] multiple recursion limit bugs (original) (raw)

Dan wolfe wolfeman@mac.com
Mon, 11 Mar 2002 09:49:36 -0800


On Monday, March 11, 2002, at 09:25 AM, Skip Montanaro wrote:

[... regarding sre recursion limits ...]

I recently added an example that demonstrates the problem, but I think the main issue is that the limitation needs to be better documented. We can then close most/all of these bug reports as "not a bug" or "known implementation limitation". Does this seem like the right approach? Jack> As long as all the stack overflow possibilities are protected with Jack> PyOSCheckStack() calls. In the past that wasn't always the case, Jack> and this created havoc on operating systems without hardware stack Jack> limits. I looked in sre.c and saw that it does call PyOSCheckStack, but it's guarded by the USESTACKCHECK macro: #if defined(USESTACKCHECK) if (level % 10 == 0 && PyOSCheckStack()) return SREERRORRECURSIONLIMIT; #endif That's defined in Include/pythonrun.h for a few platforms: #if defined(WIN32) && !defined(MSWIN64) && defined(MSCVER) /* Enable stack checking under Microsoft C */ #define USESTACKCHECK #endif Should it also be defined for MacOS versions predating MacOS X (or is this defined elsewhere for the Mac platform)?

At one time (2.0/2.1 era) I had a patch (unfortunately I've misplaced it) to fix the problem with the small stack size (512K) on Mac OS X but put it aside as Fredrik was going to do some changes to SRE engine to fix this problem... I haven't hear anything on this topic lately so I'm not sure what the status is these days.... perhaps we should check with Fredrik to see what he has up his sleeves with the SRE before implementing any changes.