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 tim.peters
Recipients karzes, tim.peters
Date 2020-10-02.20:48:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601671724.3.0.662344614789.issue41912@roundup.psfhosted.org>
In-reply-to
Content
There is no way in portable ANSI C to deduce a "safe" limit. The limits that exist were picked by hand across platforms, to be conservative guesses at what would "never" break.

You're allowed to increase the limit if you think you know better - and you may! No two platforms are the same. But - again - you do so at your own risk.  There is no bug here unless you can provoke a crash _without_ overriding the default limit.

I was there when the limit was introduced. It was introduced precisely to avoid the vast array of strange system failures that can occur when the C stack overflows - and, again, there is no portable way to detect that "it's getting close" in ANSI C.  Stack sizes provided by platform C implementations are all over the place, from kilobytes to megabytes, and can also be different yet again for threads, and there is no portable way in C to find out what they are.

"""
For my friend using Windows, a value as low as 4000 suffices, which I don't think anyone would argue is unreasonably high.
"""

For the defaults provided by Microsoft's Visual C compiler (which CPython uses), it is unreasonably high - the C stack overflows.  In fact, under the released Python 3.8.5 on my 64-bit Windows, the largest value for which your program isn't obviously broken is about 2512.  If I don't override the default recursion limit on Windows, I cannot provoke a problem with your program on Windows (instead it dies - as designed and intended - with a `RecursionError` exception instead).
History
Date User Action Args
2020-10-02 20:48:44tim.peterssetrecipients: + tim.peters, karzes
2020-10-02 20:48:44tim.peterssetmessageid: <1601671724.3.0.662344614789.issue41912@roundup.psfhosted.org>
2020-10-02 20:48:44tim.peterslinkissue41912 messages
2020-10-02 20:48:44tim.peterscreate