Issue 35542: stack exhaustion in 3.6.7

Issue35542

Created on 2018-12-20 06:53 by shuoz, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg332183 - (view) Author: shuoz (shuoz) Date: 2018-12-20 06:53
stack exhaustion in 3.6.7.

in python  3.6.7 set recursive depth 20000 will exhaustion stack and get Segmentation fault. But this dont happen in python 2.7


```
import sys
sys.setrecursionlimit(20000)
def f():
    f()
f()
```
msg332184 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-12-20 07:06
Related older issue : issue1110055

https://docs.python.org/3/library/sys.html#sys.setrecursionlimit

> The highest possible limit is platform-dependent. A user may need to set the limit higher when they have a program that requires deep recursion and a platform that supports a higher limit. This should be done with care, because a too-high limit can lead to a crash.

I think this is a known case where the stack limit is hit depending on the operating system before RecursionError can be raised when a higher recursion limit is set. On my machine (Mac 10.10.4) this segfaults on 2.7 but raises RecurstionError on Python 3.7.1. Increasing the limit to 200000 causes segfault on 3.7.1.
msg332188 - (view) Author: shuoz (shuoz) Date: 2018-12-20 07:25
thank you for your reply.
History
Date User Action Args
2022-04-11 14:59:09adminsetgithub: 79723
2018-12-20 07:25:10shuozsetstatus: open -> closed
type: security -> crash
messages: + msg332188

resolution: not a bug
stage: resolved

2018-12-20 07:06:06xtreaksetnosy: + xtreak
messages: + msg332184
2018-12-20 06:53:17shuozcreate