[docs] Error in Python 3 docs for PyMethodDef

Sandro Tosi sandro.tosi at gmail.com
Tue Aug 14 21:03:13 CEST 2012


Hello Michael,
I've just reported http://bugs.python.org/issue15657 to track your request.

Regards,
Sandro

On Fri, Apr 6, 2012 at 6:31 PM, Michael Welsh Duggan <mwd at cert.org> wrote:
> In the Python 3.2.2 documentation (and earlier Python 3 versions), in
> the Python/C API Reference Manual, chapter Object Implementation
> Support, the documentation for PyMethodDef says:
>
>   The ml_flags field is a bitfield which can include the following
>   flags. The individual flags indicate either a calling convention or a
>   binding convention. Of the calling convention flags, only METH_VARARGS
>   and METH_KEYWORDS can be combined (but note that METH_KEYWORDS alone
>   is equivalent to METH_VARARGS | METH_KEYWORDS).
>
> The bit in the parenthetical is incorrect.  If you take a look at
> PyCFunction_Call in Objects/methodobject.c, you will find a switch for
> METH_VARARGS | METH_KEYWORDS, but no switch for METH_KEYWORDS.  Hence,
> using METH_KEYWORDS will land you with a SystemError that complains
> about METH_OLDARGS.
>
> This is either a bug in the documentation, or a bug in Python.  In this
> case, since the code has persisted through three major revisions of
> Python 3, I suggest that the bug _is_ in the documentation (whether it
> should be or not), since changing the code for this at this late date
> means a programmer has to use METH_VARARGS | METH_KEYWORDS anyway for
> compatibility.
>
> It may be work pointing out specifically in the documentation that just
> using METH_KEYWORDS will not work.
>
> --
> Michael Welsh Duggan
> (mwd at cert.org)
> _______________________________________________
> docs mailing list
> docs at python.org
> http://mail.python.org/mailman/listinfo/docs



-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi


More information about the docs mailing list