SIP v4.19.23 adds dependency on assignment operator

Matthijs van der Burgh MatthijsBurgh at outlook.com
Sat Jun 27 09:47:57 BST 2020


For clarity for future readers.

It is needed to define it in the SIP file. Only defining a private assignment operator in cpp, causes the `is private within this context` error.

As you might want different API's for your python module than your cpp library, it is not needed to define it (as private or at all) in cpp. As long as you define it as private in the SIP file.

Matthijs

________________________________
Van: Jochen Sprickerhof
Verzonden: Vrijdag, 26 Juni, 2020 16:32
Aan: Phil Thompson
CC: pyqt at riverbankcomputing.com
Onderwerp: Re: SIP v4.19.23 adds dependency on assignment operator

* Phil Thompson <phil at riverbankcomputing.com> [2020-06-26 15:28]:
>>* Phil Thompson <phil at riverbankcomputing.com> [2020-06-26 14:46]:
>>>So you need to tell SIP this by defining a private assignment
>>>operator.
>>
>>I tried that but SIP still generates code that is refused by gcc:
>>
>>orocos_kdl/src/chainiksolvervel_pinv_givens.hpp:
>>
>>+     private:
>>+         ChainIkSolverVel_pinv_givens& operator=(const
>>ChainIkSolverVel_pinv_givens& other);
>>
>>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:
>>
>>extern "C" {static void
>>dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper *);}
>>static void dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper
>>*sipSelf)
>>{
>>    if (sipIsDerivedClass(sipSelf))
>>        reinterpret_cast<sipChainIkSolverVel_pinv_givens
>>*>(sipGetAddress(sipSelf))->sipPySelf = SIP_NULLPTR;
>>
>>    if (sipIsOwnedByPython(sipSelf))
>>    {
>>        release_ChainIkSolverVel_pinv_givens(sipGetAddress(sipSelf),
>>sipIsDerivedClass(sipSelf));
>>    }
>>}
>>
>>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp: In function ‘void
>>assign_ChainIkSolverVel_pinv_givens(void*, Py_ssize_t, void*)’:
>>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:1047:137: error:
>>‘KDL::ChainIkSolverVel_pinv_givens&
>>KDL::ChainIkSolverVel_pinv_givens::operator=(const
>>KDL::ChainIkSolverVel_pinv_givens&)’ is private within this context
>> 1047 |     if (sipIsDerivedClass(sipSelf))
>>
>>Do you have an idea why?
>
>You'll have to send me the relevant .sip files.

Not sure what you need but there is a PR trying to implement this here:

https://github.com/orocos/orocos_kinematics_dynamics/pull/269

>>Also, the assignment operator is already removed by the compiler,
>>having to manually define it private sounds superfluous.
>
>SIP isn't a full C++ parser - it doesn't know that the compiler will
>delete the operator.

Yeah, I guessed so already.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200627/ac1b1786/attachment-0001.htm>


More information about the PyQt mailing list