[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-08 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

'e' is "used" in the comment above: "isinstance(e, ValueError) used to fail"...
I agree to use the modern 'as' syntax.

--

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-08 Thread Mark Dickinson

Mark Dickinson  added the comment:

Style nit:  how about

'except ValueError as e'

instead of

'except ValueError, e'

(Actually, why do we need e?)

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

This will be fixed in the next 2.7 release, thanks for the report!

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 57de1ad15c54 by Amaury Forgeot d'Arc in branch '2.7':
Issue #13546: Fixed an overflow issue that could crash the intepreter when
http://hg.python.org/cpython/rev/57de1ad15c54

--
nosy: +python-dev

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Ned Deily

Ned Deily  added the comment:

LGTM

--

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
assignee:  -> amaury.forgeotdarc
stage: needs patch -> patch review

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Here is a patch, with test.

--
keywords: +patch
Added file: http://bugs.python.org/file23868/issue13546.patch

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Tested on Linux:
Python 2.7.2+ (2.7:16c4137a413c+, Dec  4 2011, 22:56:38) 
[GCC 4.4.3] on linux2
>>> import sys
>>> sys.setrecursionlimit((1<<31)-1)
>>> import xx
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' 
in  ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' 
in  ignored
Traceback (most recent call last):

This comes from PyErr_GivenExceptionMatches() which tries to "Temporarily bump 
the recursion limit", and calls Py_SetRecursionLimit(reclimit + 5); without any 
consideration for 32bit int overflow... and PyErr_WriteUnraisable() is called 
to display the error.

IDLE crashes (with a real stack overflow) because sys.stderr is a special 
RPCProxy object whose methods are found through a __getattr__. But __getattr__ 
is called when __getattribute__ raises AttributeError, right?  To implement 
this, PyErr_GivenExceptionMatches() is called again, fails again, call 
PyErr_WriteUnraisable()... recursively.

The fix should be easy: do not bump the recursion limit when it's already too 
high.

--
resolution: wont fix -> 
stage: committed/rejected -> needs patch
status: closed -> open

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Ji Han

Ji Han  added the comment:

@amaury.forgeotdarc

It says 'python.exe has stopped working'. Details:

  Problem Event Name:   APPCRASH
  Application Name: python.exe
  Application Version:  0.0.0.0
  Application Timestamp:4df4b010
  Fault Module Name:MSVCR90.dll
  Fault Module Version: 9.0.30729.6161
  Fault Module Timestamp:   4dace4e7
  Exception Code:   c0fd
  Exception Offset: 0001edcf
  ... ... ...

P.S. I'm well aware recursions won't go that deep. But crashing IDLE (instead 
of Raising an Error) by simply setting an option is still annoying.

--

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Ned Deily

Ned Deily  added the comment:

But after setting it, IDLE is going to be executing code.  In the 64-bit 
Windows Python 2.7.2 that I have available, there were exceptions reported in 
the command line interpreter (not IDLE) after changing the recursion limit and 
then executing some code.  Perhaps there is another of the known overflow error 
issues here.  OTOH, similar reports have also been closed as "won't fix", most 
recently Issue12468.  This doesn't seem worth the effort to investigate 
further.  Feel free to reopen if you disagree.

--

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

hanji, could you start IDLE from a command prompt and try again:

   c:\python27\python.exe -m idlelib.idle

Do you see additional error messages?

--

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

On the other hand, there is no reason for the recursion limit to be actually 
reached, just by setting it!  Is there a hidden infinite recursion somewhere?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Ned Deily

Ned Deily  added the comment:

Trying to set the recursion limit to a large number defeats its purpose.  As 
documented in the Standard Library Reference:

The highest possible limit is platform-dependent. A user may need to set the 
limit higher when she has 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.

http://docs.python.org/library/sys.html#sys.setrecursionlimit

--
nosy: +ned.deily
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed
type:  -> crash

___
Python tracker 

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



[issue13546] sys.setrecursionlimit() crashes IDLE

2011-12-07 Thread Ji Han

New submission from Ji Han :

The following code snippet will crash IDLE:

>>> import sys
>>> sys.setrecursionlimit((1<<31)-1)

The crash happens immediately and is consistently reproducible (environment: 
Windows 7 SP1 64-bit, Python 2.7.2 for Windows X86_64).

--
components: None
messages: 148953
nosy: hanji
priority: normal
severity: normal
status: open
title: sys.setrecursionlimit() crashes IDLE
versions: Python 2.7

___
Python tracker 

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