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.

Author aleax
Recipients aleax, georg.brandl
Date 2009-07-04.22:53:39
SpamBayes Score 2.5935014e-05
Marked as misclassified No
Message-id <1246748021.93.0.159427637238.issue6421@psf.upfronthosting.co.za>
In-reply-to
Content
http://docs.python.org/3.1/c-api/structures.html#PyMethodDef

says (under METH_VARARGS):

"""The first one is the self object for methods; for module functions,
it has the value given to Py_InitModule4 (or NULL if Py_InitModule was
used)."""

Py_InitModule4 is no more, and the first argument is now in fact a 
pointer to the module object. This is quite important, since the module 
object is now crucial for the get-state function that's supposed to 
replace a module's statics!

http://docs.python.org/3.1/extending/extending.html#a-simple-example
is ever wronger, since it says, after presenting spam_system's code:

"""The self argument is only used when the C function implements a
built-in method, not a function. In the example, self will always be a
NULL pointer, since we are defining a function, not a method. """

It will never be NULL; it will point to the module.
History
Date User Action Args
2009-07-04 22:53:42aleaxsetrecipients: + aleax, georg.brandl
2009-07-04 22:53:41aleaxsetmessageid: <1246748021.93.0.159427637238.issue6421@psf.upfronthosting.co.za>
2009-07-04 22:53:40aleaxlinkissue6421 messages
2009-07-04 22:53:39aleaxcreate