[Python-bugs-list] [ python-Bugs-548651 ] Fix the METH_CLASS implementation

noreply@sourceforge.net noreply@sourceforge.net
Fri, 06 Dec 2002 07:13:00 -0800


Bugs item #548651, was opened at 2002-04-25 11:15
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=548651&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 8
Submitted By: Thomas Heller (theller)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: Fix the METH_CLASS implementation

Initial Comment:
The devel-docs about METH_CLASS:

The method will be passed the type object as the first 
parameter rather than an instance of the type. This is 
used to create class methods, similar to what is 
created when using the classmethod() built-in 
function. New in version 2.3.

The code does not do it in this way. The first 
parameter the function receives is NULL, the type 
object goes together with the remaining arguments
in the second parameter (which is a tuple).

See the thread with subject 'METH_CLASS' on python-dev 
at 2002-04-25, Guido agreed that this should be fixed.


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

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-12-06 10:12

Message:
Logged In: YES 
user_id=3066

I'd love to see this fixed.  Priorities at work may not
allow me to spend any time on this; patches would be welcome.

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

Comment By: Thomas Heller (theller)
Date: 2002-12-06 03:19

Message:
Logged In: YES 
user_id=11105

Will this be fixed before 2.3a? Now is the *last* chance to do 
this, since it changes the sematics of C code.
In http://mail.python.org/pipermail/python-dev/2002-
April/023574.html, Guido wrote the following:
> Fred & I had a little whiteboard session.  The docs indeed
> disagree with the code, and we agree that the code should
> be fixed.  This requires some work: we'll have to introduce a
> new kind of descriptor that wraps a PyMethodDef pointer
> and creates a PyCFunction in response to the p_descr_get
> call with the type as self.  Fred will do this.
Is this still the plan? Fred, are you going to implement this?


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

Comment By: Just van Rossum (jvr)
Date: 2002-11-26 05:30

Message:
Logged In: YES 
user_id=92689

This has been open since april, and becomes immediately
relevant with rhettingers dict.fromseq() classmethod
addition: patch #643443. I hadn't seen this bug report
before, but looking at Raymond's code I wondered why cls was
passed as part of args instead of as the first arg of the C
function. I ended up here... I think it's *crucial* this is
fixed before the first alpha of 2.3 is released. Upping the
priority by one...

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

Comment By: Thomas Heller (theller)
Date: 2002-05-24 05:53

Message:
Logged In: YES 
user_id=11105

IMO this should be fixed before 2.3 is released, so I'm
raising the priority to 7.

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

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