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 sandro.tosi
Recipients docs@python, sandro.tosi
Date 2012-08-14.19:02:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344970966.7.0.115664419243.issue15657@psf.upfronthosting.co.za>
In-reply-to
Content
Hello,
it has been reported at http://mail.python.org/pipermail/docs/2012-April/008215.html but given it raises some question whether it's a bug in the doc or in the code, i'd rather report the issue here and hear what other think:

>>>
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.
<<<
History
Date User Action Args
2012-08-14 19:02:46sandro.tosisetrecipients: + sandro.tosi, docs@python
2012-08-14 19:02:46sandro.tosisetmessageid: <1344970966.7.0.115664419243.issue15657@psf.upfronthosting.co.za>
2012-08-14 19:02:45sandro.tosilinkissue15657 messages
2012-08-14 19:02:45sandro.tosicreate