This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arfrever
Recipients Arfrever
Date 2013-09-27.01:44:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380246264.16.0.783990166061.issue19098@psf.upfronthosting.co.za>
In-reply-to
Content
sys.setrecursionlimit(2**30) breaks interactive shell in Python >=3.3.
This bug does not occur during non-interactive execution of scripts / modules.
This bug does not occur in versions of Python older than 3.3.

This bug occurs only for some range of values of recursion limit. There are higher values, which do not cause this bug.
sys.setrecursionlimit(2**31), as expected, raises OverflowError.
Values like 2**31-1 (i.e. 2147483647) cause no problem:

$ python3.4 -q
>>> import sys
>>> sys.setrecursionlimit(2**31)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: signed integer is greater than maximum
>>> sys.setrecursionlimit(2**31-1)
>>> sys.getrecursionlimit()
2147483647
>>> 0
0
>>> 

Lower limit of values of recursion limit, which cause this bug: 715827883 == 2**29 + 2**27 + 2**25 + 2**23 + 2**21 + 2**19 + 2**17 + 2**15 + 2**13 + 2**11 + 2**9 + 2**7 + 2**5 + 2**3 + 2**1 + 1
Upper limit of values of recursion limit, which cause this bug: 1431655765 == 2**30 + 2**28 + 2**26 + 2**24 + 2**22 + 2**20 + 2**18 + 2**16 + 2**14 + 2**12 + 2**10 + 2**8 + 2**6 + 2**4 + 2**2 + 1

Example of this bug:

$ python3.4 -q
>>> import sys
>>> sys.setrecursionlimit(2**30)
>>> 0
RuntimeError: maximum recursion depth exceeded during compilation
>>> "a"
RuntimeError: maximum recursion depth exceeded during compilation
>>> 
RuntimeError: maximum recursion depth exceeded during compilation
>>>

RuntimeError occurs for each line (even empty). Ctrl+D still works.

I use 64-bit GNU/Linux.
History
Date User Action Args
2013-09-27 01:44:24Arfreversetrecipients: + Arfrever
2013-09-27 01:44:24Arfreversetmessageid: <1380246264.16.0.783990166061.issue19098@psf.upfronthosting.co.za>
2013-09-27 01:44:24Arfreverlinkissue19098 messages
2013-09-27 01:44:22Arfrevercreate