[issue32022] Python crashes with mutually recursive code

2017-11-22 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I confirmed that increasing the recursion limit can change recursion behavior 
on Windows.

>>> def f(): g()
...
>>> def g(): f()
...
>>> f()

With the default limit or 1000 or increase to 3000, I get a recursion error.  
With the limit set to 1, I get 'MemoryError: stack overflow'.  It is not 
too surprising that the more complicated code prevents getting even that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-22 Thread STINNER Victor

STINNER Victor  added the comment:

(Oops, must be closed as "wont fix".)

--
resolution: fixed -> wont fix

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-22 Thread STINNER Victor

STINNER Victor  added the comment:

I close the issue for the reasons given in the latest comments. Sorry!

--
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

I was going to suggest that this might be a documentation issue, but the 
existing documentation already looks sufficient to me:

> 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.

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

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-22 Thread Mark Dickinson

Mark Dickinson  added the comment:

> I suggest to close it as WONTFIX.

Agreed. If you use sys.setrecursionlimit, you're deliberately bypassing 
Python's safety mechanisms. A crash due to stack overflow shouldn't be 
considered a bug under these circumstances.

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-20 Thread STINNER Victor

STINNER Victor  added the comment:

I don't think that we can fix this issue. I suggest to close it as WONTFIX.


> sys.setrecursionlimit(3000)

While Python does its best to catch stack overflow, the C implementation of 
CPython can exhaust the stack memory (8 MB in Linux?) and then crash with a 
"stack overflow".

I suggest to rewrite your algorithm to reduce the maximum stack depth.

Or maybe try to find a way to extend the maximum size of the stack (is it 
possible without rebuilding Python?). See for example RLIMIT_STACK of the 
resource module on Unix.


> On linux x86-64 with python 3.6.3 and python 3.7.0a2+ I get a RecursionError: 
> maximum recursion depth exceeded.

The exact memory usage depends on the Python version and maybe compiler flags. 
We reduce the stack usage in Python 3.7, search for "Stack consumption" in:

https://vstinner.github.io/contrib-cpython-2017q1.html

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-18 Thread Jesse Bakker

Jesse Bakker  added the comment:

On linux x86-64 with python 3.6.3 and python 3.7.0a2+ I get a RecursionError: 
maximum recursion depth exceeded.

--
nosy: +Jesse Bakker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

PS.  When you respond by EMail, please delete the quoted message, as it is 
redundant, on the web page, with the original copy above.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-17 Thread Shimon Malachi Cohen

Shimon Malachi Cohen  added the comment:

Cool, thanks!

On Nov 18, 2017 5:29 AM, "Terry J. Reedy"  wrote:

>
> Terry J. Reedy  added the comment:
>
> I believe I used the 2nd version of kakuru.py.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I believe I used the 2nd version of kakuru.py.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

It is possible that this is a duplicate of an existing crash report, but I am 
not familiar with such at all.  With only the standard, non-specific  error 
message, it is hard to search ;-).  What OS are you using?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32022] Python crashes with mutually recursive code

2017-11-17 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The RESTART line means that you ran this in IDLE and that your program crashed 
the separate (sub)process that was running your code.  When IDLE notices this, 
it starts a new subprocess.

To test whether this is an IDLE-only problem, I ran your code without IDLE.

C:\Users\Terry>python -i -m tem
>>> doFind()
R 6 12
R 12 22
R 21 32
C 10 21
C 13 22
C 16 23

and quickly got the the Windows 'Program has stopped running' box, with no 
Python error message.  Ditto when run on 3.7.0a2.

Since this is not an IDLE issue, I revised the title.

--
nosy: +terry.reedy
stage:  -> test needed
title: Python problem - == RESTART: Shell = -> Python crashes with mutually 
recursive code
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com