pygpo: use correct method flags
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 2 Dec 2019 22:17:26 +0000 (11:17 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 4 Dec 2019 05:10:31 +0000 (05:10 +0000)
The METH_KEYWORDS argument must always be combined with METH_VARARGS.

In Python up to 3.7 this was checked at runtime, and as we had no callers to
get_unix_path() in Python we never noticed. In Python 3.8 it is checked at
import time, and everyone notices even if they aren't directly using GPOs.

Found and reported by Val Kulkov.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14209
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libgpo/pygpo.c

index 581d20e064963af3af8f82e5771a8d42cdef81fb..97bbb3ec528c850d3e37cae7923e396c12fde86f 100644 (file)
@@ -118,7 +118,7 @@ out:
 static PyMethodDef GPO_methods[] = {
        {"get_unix_path", PY_DISCARD_FUNC_SIG(PyCFunction,
                                              py_gpo_get_unix_path),
-               METH_KEYWORDS,
+               METH_VARARGS | METH_KEYWORDS,
                NULL },
        {NULL}
 };