[PyQt] Overloaded functions with same Python signature

Camden Mannett camden.mannett at gmail.com
Thu Jul 3 14:38:40 BST 2014


Ignore that, I was looking at the wrong bit code...

QDataStream* a0;
Sy_loggerInterface::RotationMetric a1;

if (sipParsePair(&sipParseErr, sipArg0, sipArg1, "J9XE",
sipType_QDataStream, &a0, sipType_Sy_loggerInterface_RotationMetric,
&a1))
{
    QDataStream*sipRes;

    try
    {
        sipRes = &(*a0 >> a1);
    }
    catch (...)
    {
        sipRaiseUnknownException();
        return NULL;
    }

     return sipConvertFromType(sipRes,sipType_QDataStream,NULL);
}

It's still passing by value, so it didn't work.

On 3 July 2014 14:27, Camden Mannett <camden.mannett at gmail.com> wrote:
> /Constrained/ is certainly correct, presumably SIP tried to convert
> the enums to ints as there is already a Qt overload for that.  I
> thought that /Out/ would be more appropriate as the right streaming
> operator doesn't read the enum, but SIP just reported the original
> error if /In/ wasn't present - so I settled on /Constrained, In, Out/.
>
> The resulting sip***cmodule.cpp  __rshift__ method looks correct:
>
> QDataStream* a0;
> Sy_version* a1;
>
> if (sipParsePair(&sipParseErr, sipArg0, sipArg1, "J9J9",
> sipType_QDataStream, &a0, sipType_Sy_version, &a1))
> {
>     QDataStream*sipRes;
>      try
>      {
>          sipRes = &(*a0 >> *a1);
>       }
>
> On 3 July 2014 13:54, Phil Thompson <phil at riverbankcomputing.com> wrote:
>> On 03/07/2014 1:19 pm, Camden Mannett wrote:
>>>
>>> SIP/PyQt5 is reporting an error during the parsing of my sip file:
>>>
>>> __rshift__() has overloaded functions with the same Python signature
>>>
>>> The offending functions are:
>>>
>>> QDataStream& operator<<( QDataStream& stream,
>>>                          const Sy_loggerInterface::DebugLevel& obj );
>>> QDataStream& operator>>( QDataStream& stream,
>>>                          Sy_loggerInterface::DebugLevel& obj );
>>>
>>> QDataStream& operator<<( QDataStream& stream,
>>>                          const Sy_loggerInterface::RotationMetric& obj );
>>> QDataStream& operator>>( QDataStream& stream,
>>>                          Sy_loggerInterface::RotationMetric& obj );
>>>
>>> Sy_loggerInterface::DebugLevel and Sy_loggerInterface::RotationMetric
>>> are enums, so they clearly don't have the same signature in C++. But I
>>> don't know what the created Python signature would look like.
>>>
>>> Also note the left shift operators do not cause an error when I
>>> comment out one of the right shift ones, and simply changing the names
>>> of the parameters has no effect (as you would expect). Does anyone
>>> know what I can do to fix this error?
>>
>>
>> The only similar thing in PyQt applies /Constrained, In/ to the argument.
>> However I'm not convinced it will do the right thing.
>>
>> Phil
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list