[ python-Bugs-1165306 ] Property access with decorator makes interpreter crash

SourceForge.net noreply at sourceforge.net
Thu Mar 17 18:03:24 CET 2005


Bugs item #1165306, was opened at 2005-03-17 09:56
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1165306&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 6
Submitted By: Remy Blank (remyblank)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Property access with decorator makes interpreter crash

Initial Comment:
The attached file makes the interpreter crash.
Basially, a method is decorated, and used as the getter
function for a property. Accessing the property
provokes the crash.

I get the following output (linux-2.6.10):

joe at pat TestCases $ ./crashTest.py
Creating instance
Getting value
Segmentation fault

Using python-2.3.4 from Gentoo, i.e. it has a few
patches from 2.3.5.

On Windows XP with python-2.4, I get a "Python has
encountered a problem and needs to close." dialog box.

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2005-03-17 12:03

Message:
Logged In: YES 
user_id=6380

Looks like I wasn't finished with the thought when I checked
it in. I think I was trying to make instancemethod generally
useful as a currying primitive. That should probably be
considered more careful; please roll it back.

(I think it may have been part of the aborted experiment to
get rid of bound methods.)

Is there time to backport this to 2.4.1?

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

Comment By: Michael Hudson (mwh)
Date: 2005-03-17 11:44

Message:
Logged In: YES 
user_id=6656

Hmm.  A little CVS log reading finds us this:

revision 2.170
date: 2003/04/09 19:35:08;  author: gvanrossum;  state: Exp;  lines: +2 -2
branches:  2.170.10;
Make it possible to call instancemethod() with 2 arguments.

Guido, what was the motivation for this?  Is it possible to create 
instancemethods with im_class == NULL some other way?  (If there is, I 
don't see it).

Also, you didn't add a unit test <poke> (in fact, instancemethod_new only 
gets called twice during a run of the test suite, both times with three 
arguments).

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

Comment By: Michael Hudson (mwh)
Date: 2005-03-17 10:17

Message:
Logged In: YES 
user_id=6656

Confirmed, on 2.4 HEAD, even.

There's a lot going on in your test file that is unecessary, though; this is a 
smaller test case:

types.MethodType(lambda :None, None)(1)

instancemethod_call doesn't seem to expect im_class to be NULL...

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

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


More information about the Python-bugs-list mailing list