[Python-bugs-list] [ python-Bugs-528132 ] classmethod().__get__() segfault
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 17 Mar 2002 19:10:34 -0800
Bugs item #528132, was opened at 2002-03-10 10:19
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=528132&group_id=5470
Category: Type/class unification
Group: Python 2.2.1 candidate
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Armin Rigo (arigo)
Assigned to: Guido van Rossum (gvanrossum)
Summary: classmethod().__get__() segfault
Initial Comment:
Calling the __get__ method of a classmethod object
with a single argument causes a segmentation fault in
the interpreter :
def f(): pass
classmethod(f).__get__(0)
This is caused by an internal inconsistency between
the __get__ wrapper function in C that calls the
tp_descr_get slot with a NULL third argument in this
case and some tp_descr_get slot implementations (like
the classmethods') which dereference it with no check.
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-17 22:10
Message:
Logged In: YES
user_id=6380
Fixed it, both in 2.2.1 branch and in 2.3 trunk. The "idiot
fix" (not my words) below didn't quite do it, but letting
type default to obj->ob_type does the trick.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-17 18:08
Message:
Logged In: YES
user_id=6380
Alas, not tonight. Tomorrow morning for sure.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-17 17:10
Message:
Logged In: YES
user_id=6380
Alas, it looks I can still force a segfault by calling the
resulting unbound method with a bogus argument. I'll look
into this now.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2002-03-17 15:11
Message:
Logged In: YES
user_id=6656
Guido, is this fix sane?
No other implementation of tp_descr_get seems to be at risk.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2002-03-16 12:37
Message:
Logged In: YES
user_id=6656
Oopsie, we'll have this one fixed for 2.2.1.
I think you mangaged to submit this bug during a time when
bug email was somewhat hosed...
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=528132&group_id=5470