Issue 4720: Extension function optional argument specification | causes RuntimeError (original) (raw)

Calling the following extension function

static PyObject * baz(PyObject *self, PyObject *args, PyObject *keywds) { static char *kwlist[] = {NULL}; if (!PyArg_ParseTupleAndKeywords(args,keywds,"|:bar.baz", kwlist)) return NULL; return Py_BuildValue(""); }

raises

RuntimeError: more argument specifiers than keyword list entries (remaining format:'|:bar.baz')

in Python 2.6 but it used to work with earlier versions of Python.

This bug breaks all f2py generated extension modules when using Python 2.6.