[Python-Dev] multiple recursion limit bugs
Skip Montanaro
skip@pobox.com
Mon, 11 Mar 2002 11:25:08 -0600
[... 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> PyOS_CheckStack() 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 PyOS_CheckStack, but it's
guarded by the USE_STACKCHECK macro:
#if defined(USE_STACKCHECK)
if (level % 10 == 0 && PyOS_CheckStack())
return SRE_ERROR_RECURSION_LIMIT;
#endif
That's defined in Include/pythonrun.h for a few platforms:
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
/* Enable stack checking under Microsoft C */
#define USE_STACKCHECK
#endif
Should it also be defined for MacOS versions predating MacOS X (or is this
defined elsewhere for the Mac platform)?
Skip