This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: classmethod(classmethod(foo)) -> SystemError
Type: Stage:
Components: None Versions: Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: anthonybaxter Nosy List: anthonybaxter, rhettinger
Priority: normal Keywords:

Created on 2003-07-13 08:54 by anthonybaxter, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Messages (4)
msg17045 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-07-13 08:54
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

msg17046 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-07-13 09:45
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.
msg17047 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-07-13 10:12
Logged In: YES 
user_id=29957

Re-opening, assigning to myself to remind me to do the backport.
msg17048 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-07-13 13:58
Logged In: YES 
user_id=29957

Backported. Thanks for the pointer!
(also fixed identical bug in Zope3's ContextMethod)

Checking in Objects/funcobject.c;
/cvsroot/python/python/dist/src/Objects/funcobject.c,v  <--
 funcobject.c
new revision: 2.50.4.4; previous revision: 2.50.4.3
done
Checking in Lib/test/test_descr.py;
/cvsroot/python/python/dist/src/Lib/test/test_descr.py,v 
<--  test_descr.py
new revision: 1.113.4.35; previous revision: 1.113.4.34
done
History
Date User Action Args
2022-04-10 16:09:57adminsetgithub: 38845
2003-07-13 08:54:09anthonybaxtercreate