[issue19976] Argument Clinic: generate second arg for METH_NOARGS

Stefan Krah report at bugs.python.org
Fri Dec 13 17:00:24 CET 2013


Stefan Krah added the comment:

STINNER Victor <report at bugs.python.org> wrote:
> If you prefer to add the unused parameter, what do you propose to avoid compiler warnings if unused parameters are checked?

This works quite portably in _decimal (I don't get warnings from gcc, icc,
suncc, Visual Studio, aCC, clang):

#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  #define UNUSED __attribute__((unused))
#else
  #define UNUSED
#endif

static PyObject *
signaldict_copy(PyObject *self, PyObject *args UNUSED)
{
    return flags_as_dict(SdFlags(self));
}

We could call the macro PY_UNUSED or something.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19976>
_______________________________________


More information about the Python-bugs-list mailing list