1# 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 exercises 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 17