Compile error with sip 6.7.10 - variable number of arguments

Scott Talbert swt at techie.net
Fri Jul 28 15:36:34 BST 2023


On Tue, 25 Jul 2023, Scott Talbert wrote:

> Hi Phil,
>
> Sorry I didn't get a chance to test the prerelease of sip 6.7.10 with 
> wxPython.  Unfortunately, I'm running into a compile issue with 6.7.10.
>
> In file included from /usr/include/python3.11/Python.h:38,
>                 from ../../../../sip/siplib/sip.h:24,
>                 from ../../../../sip/cpp/sipAPI_core.h:13,
>                 from ../../../../sip/cpp/sip_corecmodule.cpp:10:
> ../../../../sip/cpp/sip_corecmodule.cpp: In function ‘PyObject* 
> func_LogInfo(PyObject*, PyObject*)’:
> ../../../../sip/cpp/sip_corecmodule.cpp:15761:23: error: ‘a1’ was not 
> declared in this scope; did you mean ‘y1’?
> 15761 |             Py_DECREF(a1);
>      |                       ^~
> /usr/include/python3.11/pyport.h:24:38: note: in definition of macro 
> ‘_Py_CAST’
>   24 | #define _Py_CAST(type, expr) ((type)(expr))
>      |                                      ^~~~
> /usr/include/python3.11/object.h:541:33: note: in expansion of macro 
> ‘_PyObject_CAST’
>  541 | #define Py_DECREF(op) Py_DECREF(_PyObject_CAST(op))
>      |                                 ^~~~~~~~~~~~~~
> ../../../../sip/cpp/sip_corecmodule.cpp:15761:13: note: in expansion of macro 
> ‘Py_DECREF’
> 15761 |             Py_DECREF(a1);
>      |             ^~~~~~~~~
>
>
> This error occurs in a function called wxLogInfo which is defined in a .sip 
> file like this:
>
> void wxLogInfo(
>    const char * formatString,
>    ...
> );
> %Docstring
>    LogInfo(formatString, )
>
>    For low priority messages.
> %End
>
>
> SIP 6.7.9 generated code:
>
> extern "C" {static PyObject *func_LogInfo(PyObject *,PyObject *);}
> static PyObject *func_LogInfo(PyObject *,PyObject *sipArgs)
> {
>    PyObject *sipParseErr = SIP_NULLPTR;
>
>    {
>        const char* formatString;
>        PyObject * a1;
>
>        if (sipParseArgs(&sipParseErr, sipArgs, "sW", &formatString, &a1))
>        {
>            PyErr_Clear();
>
>            Py_BEGIN_ALLOW_THREADS
>            wxLogInfo(formatString,a1);
>            Py_END_ALLOW_THREADS
>
>            Py_DECREF(a1);
>
>            if (PyErr_Occurred())
>                return 0;
>
>            Py_INCREF(Py_None);
>            return Py_None;
>        }
>    }
>
>    /* Raise an exception if the arguments couldn't be parsed. */
>    sipNoFunction(sipParseErr, sipName_LogInfo, SIP_NULLPTR);
>
>    return SIP_NULLPTR;
> }
>
>
> SIP 6.7.10 generated code:
>
> extern "C" {static PyObject *func_LogInfo(PyObject *,PyObject *);}
> static PyObject *func_LogInfo(PyObject *,PyObject *sipArgs)
> {
>    PyObject *sipParseErr = SIP_NULLPTR;
>
>    {
>        const char* formatString;
>        PyObject * *args;
>
>        if (sipParseArgs(&sipParseErr, sipArgs, "sW", &formatString, &*args))
>        {
>            PyErr_Clear();
>
>            Py_BEGIN_ALLOW_THREADS
>            wxLogInfo(formatString,*args);
>            Py_END_ALLOW_THREADS
>
>            Py_DECREF(a1);
>
>            if (PyErr_Occurred())
>                return 0;
>
>            Py_INCREF(Py_None);
>            return Py_None;
>        }
>    }
>
>    /* Raise an exception if the arguments couldn't be parsed. */
>    sipNoFunction(sipParseErr, sipName_LogInfo, SIP_NULLPTR);
>
>    return SIP_NULLPTR;
> }
>
>
> Looks like a1 got renamed but not completely?

Seems like it could be related to this change:
https://www.riverbankcomputing.com/hg/sip/rev/b4636fcdb515

Scott


More information about the PyQt mailing list