[Python-bugs-list] [ python-Bugs-503091 ] new.instancemethod fails for new classes
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 15 Jan 2002 11:21:45 -0800
Bugs item #503091, was opened at 2002-01-13 14:28
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=503091&group_id=5470
Category: Python Library
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Pedro Rodriguez (pedro_rodriguez)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: new.instancemethod fails for new classes
Initial Comment:
The following code exhibit the problem :
import new
# OK
def n(self): pass
class A:
def f(self): pass
print new.instancemethod(n, None, A)
# FAILS with
# Traceback (most recent call last):
# File "bug.py", line 18, in ?
# print new.instancemethod(n, None, B)
# TypeError: instancemethod() argument 3 must be class,
# not type
def m(self): pass
class B(object):
def f(self): pass
print new.instancemethod(n, None, B)
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-01-15 11:21
Message:
Logged In: YES
user_id=6380
You're right. The new.instancemethod() call makes
unnecessary typechecks. Fixed in CVS. Should be ported to
2.2.1.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=503091&group_id=5470