[Python-Dev] Re: Another test_compiler mystery (original) (raw)

Tim Peters tim.peters at gmail.com
Thu Aug 12 21:41:37 CEST 2004


[Tim]

Looks like nobody has an explanation yet for why 2.3.4 consistently yielded MemoryError but 2.4a2 mixes those with spurious KeyError and SyntaxError exceptions.

[Armin]

The reason is that PyEnterRecursiveCall() was only introduced in 2.4. Comparisons didn't throw RuntimeErrors that easily in 2.3.

Doh! Of course. Recursive compares aren't implicated in the test programs that failed here. Under 2.3.4, all the compares return normally because they're not stack-checking at all, and the program "gets to" recurse deeper then, until a "recursion depth exceeded" exception gets thrown. But in 2.4 it's a crap shoot whether a comparison or a recursive Python call notices first that we're nearing the end of the stack. The recursive Python calls make real stack demands in these tests, but the comparisons are just int-vs-int and string-vs-string, so the stack-check in compare now is "almost always" a nuisance check in these tests.

Sounds like a good idea not to run out to stack .



More information about the Python-Dev mailing list