[Python-bugs-list] [ python-Bugs-753451 ] classmethod abuse --> SystemError

SourceForge.net noreply@sourceforge.net
Tue, 17 Jun 2003 18:13:56 -0700


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

Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Michael Hudson (mwh)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: classmethod abuse --> SystemError

Initial Comment:
This is obviously a silly thing to do:

>>> classmethod(1).__get__(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: ../Objects/classobject.c:2102: bad
argument to internal function

but I think that's still a bug.

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-17 20:13

Message:
Logged In: YES 
user_id=80475

Added a callability check.
See Objects/funcobject.c 1.195

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

Comment By: Brett Cannon (bcannon)
Date: 2003-06-15 03:00

Message:
Logged In: YES 
user_id=357491

Well, couldn't we check if the argument is a non-data descriptor 
at least?  Since classmethod only works with new-style we know 
the method will be a non-data descriptor.  That should prevent 
allowing arguments like 1 being allowed through.

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

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