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