[New-bugs-announce] [issue43674] strange effect at recursion limit

TW report at bugs.python.org
Tue Mar 30 15:50:29 EDT 2021


New submission from TW <tw at waldmann-edv.de>:

user at development:~$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

def recurse(n):
    print(n)
    try:
        recurse(n+1)
    except RecursionError:
        print("recursion error")
    print(n)


Please note that there are 2 print(n) on the same level.

>>> recurse(0)
0
1
2
...
994
995
recursion error
994
993
...
2
1
0

Why is there no 2nd 995 after the recursion error?

Same happens for python 3.8.8 and 3.9.2.

Related question:

I also tried to set sys.setrecursionlimit(100000) and ran recurse(0), but at a bit beyond 21800, it just segfaulted.

Is there a way to determine the practically working maximum it can do?

----------
components: Interpreter Core
messages: 389848
nosy: ThomasWaldmann2
priority: normal
severity: normal
status: open
title: strange effect at recursion limit
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43674>
_______________________________________


More information about the New-bugs-announce mailing list