[Python-Dev] METH_CLASS

Thomas Heller thomas.heller@ion-tof.com
Thu, 25 Apr 2002 14:46:13 +0200


The devel-docs tell me 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.

1. This seems wrong. 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).

Is the documentation wrong, or is the code wrong (I didn't find
any use of METH_CLASS in the CVS sources)?

[I must say that I'm not really sure how this relates to the
calling convention flags. Have tried METH_O and METH_VARARGS
so far.]

2. Since this is marked new in 2.3: Is it planned to backport
this stuff into the 2.2.x series?
Requiring Python 2.3 for my stuff seems a but harsh currently...

3. While we're at it, although I could try to find out myself:
How would one create a classmethod in Python 2.2?

Thanks,

Thomas