Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue1686386] Python SEGFAULT on invalid superclass access

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 30, 2007, 2:18 AM

Post #1 of 8 (317 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access

TH
added the comment:

Here is a patch correcting the problem, with tests. It doesn't have much
to do with exception, it's mainly a problem with PyObject_Str and
PyObject_Repr, that I corrected with Py_EnterRecursiveCall calls.

Maybe the bug should be reclassified, at least the title changed.

----------
nosy: +therve
type: -> crash

_____________________________________
Tracker <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
Attachments: 1686386.diff (1.34 KB)


report at bugs

Aug 30, 2007, 8:23 AM

Post #2 of 8 (303 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

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 <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 6, 2007, 3:15 AM

Post #3 of 8 (292 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

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 <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 6, 2007, 6:35 AM

Post #4 of 8 (294 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

toxik added the comment:

Hm, may be so.

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

_____________________________________
Tracker <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 12, 2007, 12:34 PM

Post #5 of 8 (283 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

Georg Brandl added the comment:

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

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

_____________________________________
Tracker <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 12, 2007, 12:52 PM

Post #6 of 8 (280 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

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 <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 12, 2007, 12:52 PM

Post #7 of 8 (281 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

Changes by Brett Cannon:


----------
versions: +Python 2.6

_____________________________________
Tracker <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Sep 12, 2007, 2:13 PM

Post #8 of 8 (286 views)
Permalink
[issue1686386] Python SEGFAULT on invalid superclass access [In reply to]

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 <report [at] bugs>
<http://bugs.python.org/issue1686386>
_____________________________________
Attachments: infinite_rec_fix.diff (1.61 KB)

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.