New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
recursion core dumps #41493
Comments
when running recursive function you get a coredump with from sys import *
n = 30000
setrecursionlimit(n+1)
def fact(n):
if n==1:
return 1
return fact(n-1)*n
fact(n) This is seen on linux i686 with both python2.3 and this is what gdb tells me: (no debugging symbols found) warning: current_sos: Can't read pathname for load map: Reading symbols from /lib/tls/libpthread.so.0...(no #0 0x400c94bf in mallopt () from /lib/tls/libc.so.6 |
Logged In: YES This looks like a stack overflow. There's not much python Also, at least in the reproducable, the number you are building I ran this test (to avoid creating a giant long number) and still from sys import *
n = 30000
setrecursionlimit(n+1)
def nofact(n):
if n==1:
return 1
return nofact(n-1)
nofact(n) |
Logged In: YES The fact that an error occurs is not surprising. Python is The fact that it gets to nearly 30k levels of recursion for I believe that the reason you are getting a segfault on Unfortunately, there is no way that Python (or any other Furthermore, as per the docs here: " The highest possible limit is platform-dependent. A user may I would suggest that this bug be closed as "3rd party, will |
Logged In: YES The docs for setrecursionlimit() are indeed already quite clear |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: