[New-bugs-announce] [issue6421] errors in docs re module initialization vs self arg to functions
Alex Martelli
report at bugs.python.org
Sun Jul 5 00:53:41 CEST 2009
New submission from Alex Martelli <aleaxit at gmail.com>:
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.
----------
assignee: georg.brandl
components: Documentation
keywords: easy
messages: 90134
nosy: aleax, georg.brandl
priority: normal
severity: normal
status: open
title: errors in docs re module initialization vs self arg to functions
type: behavior
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6421>
_______________________________________
More information about the New-bugs-announce
mailing list