blob: 1fa4d325431703733d351af8822fd814a985bb36 [file] [log] [blame]
Armin Rigo5a9a2a32006-07-25 18:11:07 +00001# The following example may crash or not depending on the platform.
2# E.g. on 32-bit Intel Linux in a "standard" configuration it seems to
3# crash on Python 2.5 (but not 2.4 nor 2.3). On Windows the import
4# eventually fails to find the module, possibly because we run out of
5# file handles.
6
7# The point of this example is to show that sys.setrecursionlimit() is a
8# hack, and not a robust solution. This example simply exercices a path
9# where it takes many C-level recursions, consuming a lot of stack
10# space, for each Python-level recursion. So 1000 times this amount of
11# stack space may be too much for standard platforms already.
12
13import sys
14if 'recursion_limit_too_high' in sys.modules:
15 del sys.modules['recursion_limit_too_high']
16import recursion_limit_too_high