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.

Title: METH_KEYWORDS alone gives "METH_OLDARGS is no longer supported!"
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: Error in Python 3 docs for PyMethodDef
View: 15657
Assigned To: Nosy List: berker.peksag, cdarke, jesse.p.ogle, ysj.ray, ztane
Priority: normal Keywords:

Created on 2011-03-17 14:17 by cdarke, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg131253 - (view) Author: Clive Darke (cdarke) Date: 2011-03-17 14:17
In the PyMethodDef struct, METH_VARARGS | METH_KEYWORDS works fine.

METH_KEYWORDS on its own gives:
"SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported!"

METH_KEYWORDS on its own tested OK on 2.6 and 2.7, fails as described on 3.1.2 and 3.2.
msg131254 - (view) Author: ysj.ray (ysj.ray) Date: 2011-03-17 14:32
Looks like just the problem of error msg.
msg131258 - (view) Author: Clive Darke (cdarke) Date: 2011-03-17 14:44
Same error on 3.2 with Windows MSC v.1500 and Linux gcc version 4.1.2
msg188729 - (view) Author: Jesse Paul Ogle (jesse.p.ogle) Date: 2013-05-08 17:44
Same error with Python 3.3.1

Objects/methodobject.c: PyCFunction_Call()

Switch contains case for "METH_VARARGS | METH_KEYWORDS" but not "METH_KEYWORDS". I assume this is on purpose?
msg241514 - (view) Author: Antti Haapala (ztane) * Date: 2015-04-19 12:59
This is *still* there in Hg tip: PyCFunction_Call in Objects/methodobject.c does not have a case for `METH_KEYWORDS` only at all.

The documentation for METH_KEYWORDS says that it is *typically* coupled with METH_VARARGS; however not having the case means that METH_KEYWORDS *cannot* be used without METH_VARARGS at all.

Furthermore, the default case should actually report the wrong flags value instead of calling it the "METH_OLDARGS", since it can be caused by any future combination, by setting it to zero, or undefined behaviour causing the flag to be overwritten.
msg241782 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-04-22 07:13
issue 15657 is actually a duplicate of this issue, but since there's more information there I'm closing this. Please take a look the patch at issue 15657. Thank you all!
Date User Action Args
2022-04-11 14:57:14adminsetgithub: 55796
2015-04-22 07:13:28berker.peksagsetstatus: open -> closed

superseder: Error in Python 3 docs for PyMethodDef

nosy: + berker.peksag
messages: + msg241782
resolution: duplicate
stage: resolved
2015-04-19 12:59:01ztanesetnosy: + ztane
messages: + msg241514
2013-05-08 17:44:39jesse.p.oglesetnosy: + jesse.p.ogle

messages: + msg188729
versions: + Python 3.3
2011-03-17 14:44:39cdarkesetmessages: + msg131258
2011-03-17 14:32:16ysj.raysetnosy: + ysj.ray
messages: + msg131254
2011-03-17 14:17:29cdarkecreate