[Python-bugs-list] [ python-Bugs-567376 ] __imul__ broken for new-style classes

noreply@sourceforge.net noreply@sourceforge.net
Tue, 11 Jun 2002 05:13:42 -0700


Bugs item #567376, was opened at 2002-06-11 07:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=567376&group_id=5470

Category: None
Group: None
>Status: Deleted
Resolution: None
Priority: 5
Submitted By: David Abrahams (david_abrahams)
Assigned to: Nobody/Anonymous (nobody)
Summary: __imul__ broken for new-style classes

Initial Comment:
Taken from python-list:

From: Alexander Schmolck <a.schmolck@gmx.net>:
-----

OK, after unsuccessfully trying for about half an hour to 
submit this to the
sf bug tracker, I gave up:

class Breaky(object):
    def __imul__(self, other):
        print "imuling"
        return self
sq = Breaky()
sq *=1.

gives:

Traceback (most recent call last):[...] line 10, in ?
    sq *=1.
TypeError: can't multiply sequence to non-int

Unless I'm overlooking something, this is a fairly serious 
bug and I can't see
a way to work around it (getattribute would presumably 
work, but slow
everything down unacceptably, so the only 'solution' 
seems to be to have no
inplace-multiplication).

I had the same behavior on two different machines 
(running Mandrake 8.2 and
Suse 7.3).

alex

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

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