[ python-Bugs-1686386 ] Python SEGFAULT on invalid superclass access

SourceForge.net noreply at sourceforge.net
Thu Mar 22 23:09:54 CET 2007


Bugs item #1686386, was opened at 2007-03-22 23:00
Message generated for change (Comment added) made by ludvig.ericson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1686386&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: toxik (ludvig.ericson)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python SEGFAULT on invalid superclass access

Initial Comment:
When one uses a class that has derived BaseException in one way or another and uses an invalid super() and calls a function upon that object, Python dies with SIGSEGV.

Reproduce code:
>>> class X(BaseException):
...     def __init__(self):
...             super(X, self).__init__(self)
... 
>>> X()
Segmentation fault

I could reproduce this on two different Python 2.5 installations.

This is as much as I could get from gdb:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211660624 (LWP 30234)]
0xb7ea601c in _PyObject_GC_Malloc () from /usr/lib/libpython2.5.so.1.0
(gdb) bt
#0  0xb7ea601c in _PyObject_GC_Malloc () from /usr/lib/libpython2.5.so.1.0
#1  0xb7ea613b in _PyObject_GC_NewVar () from /usr/lib/libpython2.5.so.1.0
#2  0xb7e4abe4 in PyTuple_New () from /usr/lib/libpython2.5.so.1.0
#3  0xb7e4b48d in ?? () from /usr/lib/libpython2.5.so.1.0
#4  0x00000001 in ?? ()
#5  0x00000000 in ?? ()


----------------------------------------------------------------------

>Comment By: toxik (ludvig.ericson)
Date: 2007-03-22 23:09

Message:
Logged In: YES 
user_id=1373326
Originator: YES

It might be added that this works (throws an exception) in python 2.4
(though, BaseException does not exist there):
TypeError: super() argument 1 must be type, not classobj


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1686386&group_id=5470


More information about the Python-bugs-list mailing list