[issue42951] Random and infinite loop in dealing with recursion error for "try-except "

Serhiy Storchaka report at bugs.python.org
Mon Jan 18 10:59:07 EST 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Funny. But the output is not random. You can generate the sequence of letters by the following simple loop:

s = ''
for i in range(n):
    s = f'a{s}b{s}'

The length of this sequence is 2*(2**n-1). Finally, your code will raise a non-silenced RecursiveError, but it will just take some time (for printing around 2**1000 letters).

----------

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


More information about the Python-bugs-list mailing list