New submission from Arfrever Frehtes Taifersar Arahesis:

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.

----------
components: Interpreter Core
keywords: 3.3regression
messages: 198460
nosy: Arfrever
priority: normal
severity: normal
status: open
title: sys.setrecursionlimit(2**30) breaks interactive shell
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19098>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to