[issue1686386] Python SEGFAULT on invalid superclass access

2007-08-30 Thread toxik

toxik added the comment:

Minor note: The patch mixes tabs and spaces. AFAIK, PEP 7 says to use
four spaces when making new code, and follow suite in legacy, or convert it.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-06 Thread Thomas Herve

Thomas Herve added the comment:

object.c is already inconsistent about tabs and space :). It may be
better to fix it in the commit, not to clutter the patch. But I can
provide a new patch if necessary.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-06 Thread toxik

toxik added the comment:

Hm, may be so.

Feel free to change title/severity if you'd like to.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-12 Thread Georg Brandl

Georg Brandl added the comment:

Brett, you recently fixed an infinite recursion crasher, right?

--
assignee:  -> brett.cannon
nosy: +brett.cannon

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-12 Thread Brett Cannon

Brett Cannon added the comment:

So the first example (in msg31624) crashes because of infinite recursion
with the repr of exceptions::

#7771 0x00065178 in BaseException_repr (self=0x5dc6b8) at
Objects/exceptions.c:128
#7772 0x0001d90c in PyObject_Repr (v=0x5dc6b8) at Objects/object.c:362
#7773 0x0008c180 in tuplerepr (v=0x5dad58) at Objects/tupleobject.c:221

The second one in msg31626 dies because of the str of exceptions::

#3839 0x0001dd88 in PyObject_Str (v=0x5dc6b8) at Objects/object.c:427
#3840 0x00065120 in BaseException_str (self=0x5dc6b8) at
Objects/exceptions.c:110
#3841 0x0001dc0c in _PyObject_Str (v=0x5dc6b8) at Objects/object.c:407

Both fail because BaseException uses the str/repr of its arguments to
construct what string to return.  When it's itself it just goes on
forever trying to get the next object's representation.

The repr issue might be fixed by looking at how lists catch loops in
themselves (don't remember the exact C function).  Either way it is not
really str/repr that is causing the issue but exceptions for not
worrying about possible recursion thanks to using the str/repr of
contained objects.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-12 Thread Brett Cannon

Changes by Brett Cannon:


--
versions: +Python 2.6

_
Tracker <[EMAIL PROTECTED]>

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



[issue1686386] Python SEGFAULT on invalid superclass access

2007-09-12 Thread Brett Cannon

Brett Cannon added the comment:

OK, so I have attached a possible patch.  I found out that
tuple.__repr__ didn't do anything to prevent infinite recursion since
you can't pull it off from Python code.  But obviously C code is another
matter.  =)

Same goes for object.__str__; it didn't think about a type's tp_str
doing something that could lead to an infinite recursion.

Assigning back to Georg to make sure I am not doing something stupid nor
that the approach is to broad by changing _PyObject_Str() and
tuple.__repr__ instead of BaseException itself.

I have not written tests yet as they are rather difficult to do for what
the C code is doing without relying specifically on how exceptions do
their __repr__/__str__.

--
assignee: brett.cannon -> georg.brandl
keywords: +patch
status: open -> pending

_
Tracker <[EMAIL PROTECTED]>

_

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