Message90134
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. |
|
Date |
User |
Action |
Args |
2009-07-04 22:53:42 | aleax | set | recipients:
+ aleax, georg.brandl |
2009-07-04 22:53:41 | aleax | set | messageid: <1246748021.93.0.159427637238.issue6421@psf.upfronthosting.co.za> |
2009-07-04 22:53:40 | aleax | link | issue6421 messages |
2009-07-04 22:53:39 | aleax | create | |
|