[Python-bugs-list] [ python-Bugs-770465 ] classmethod(classmethod(foo)) -> SystemError

SourceForge.net noreply@sourceforge.net
Sun, 13 Jul 2003 02:45:27 -0700


Bugs item #770465, was opened at 2003-07-13 03:54
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=770465&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Duplicate
Priority: 5
Submitted By: Anthony Baxter (anthonybaxter)
Assigned to: Nobody/Anonymous (nobody)
Summary: classmethod(classmethod(foo)) -> SystemError

Initial Comment:
Using 2.2.3 or current release22-maint:

>>> classmethod(classmethod(None)).__get__(1) 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: Objects/classobject.c:2022: bad argument
to internal function
(thanks to Steve Alexander for the one-line example)

This produces the error "classmethod is not callable"
in 2.3,
but no systemerror - dunno if 2.3 could provide a
better error message here.


A more realistic example (derived from the code that
originally tripped me up):

>>> class a:
...     def foo(self):
...         print "self is", self, type(self)
...     foo=classmethod(foo)
...     foo=classmethod(foo)
... 
>>> b=a()
>>> b.foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: Objects/classobject.c:2022: bad argument
to internal function



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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-13 04:45

Message:
Logged In: YES 
user_id=80475

This was fixed in revision 2.63 on Jun 18, 2003
and marked as a backport candidate.  See SF bug #753451.


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

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