Re: SIP v4.19.23 adds dependency on assignment operator
Matthijs van der Burgh <[email protected]> Sat, 27 Jun 2020 08:47:57 +0000
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <AM0PR09MB3443FF554400127ED4F672FDA2900@AM0PR09MB3443.eurprd09.prod.outlook.com> |
--_000_AM0PR09MB3443FF554400127ED4F672FDA2900AM0PR09MB3443eurp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable For clarity for future readers. It is needed to define it in the SIP file. Only defining a private assignme= nt 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 libr= ary, it is not needed to define it (as private or at all) in cpp. As long a= s you define it as private in the SIP file. Matthijs ________________________________ Van: Jochen Sprickerhof Verzonden: Vrijdag, 26 Juni, 2020 16:32 Aan: Phil Thompson CC: [email protected] Onderwerp: Re: SIP v4.19.23 adds dependency on assignment operator * Phil Thompson <[email protected]> [2020-06-26 15:28]: >>* Phil Thompson <[email protected]> [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=3D(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 =3D SIP_NULLPTR; >> >> if (sipIsOwnedByPython(sipSelf)) >> { >> release_ChainIkSolverVel_pinv_givens(sipGetAddress(sipSelf), >>sipIsDerivedClass(sipSelf)); >> } >>} >> >>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp: In function =91void >>assign_ChainIkSolverVel_pinv_givens(void*, Py_ssize_t, void*)=92: >>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:1047:137: error: >>=91KDL::ChainIkSolverVel_pinv_givens& >>KDL::ChainIkSolverVel_pinv_givens::operator=3D(const >>KDL::ChainIkSolverVel_pinv_givens&)=92 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. --_000_AM0PR09MB3443FF554400127ED4F672FDA2900AM0PR09MB3443eurp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable <html> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1= 252"> <style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo= ttom:0;} </style> </head> <body dir=3D"ltr"> <div style=3D"font-family: Calibri, Arial, Helvetica, sans-serif; font-size= : 12pt; color: rgb(0, 0, 0);"> </div> <div style=3D"margin: 0px; font-size: 12pt; font-family: Calibri, Arial, He= lvetica, sans-serif; color: black; background-color: rgb(255, 255, 255)"> For clarity for future readers.<br> </div> <div style=3D"margin: 0px; font-size: 12pt; font-family: Calibri, Arial, He= lvetica, sans-serif; color: black; background-color: rgb(255, 255, 255)"> <br> It is needed to define it in the SIP file. Only defining a private assignme= nt operator in cpp, causes the `<span style=3D"margin: 0px; font-size: 13.4= 4px; font-family: Verdana, Geneva, Helvetica, Arial, sans-serif; background= -color: white">is private within this context</span>` error.<br> <br> </div> <div style=3D"margin: 0px; font-size: 15px; font-family: "Segoe UI&quo= t;, "Segoe UI Web (West European)", "Segoe UI", -apple-= system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;= color: rgb(32, 31, 30); background-color: rgb(255, 255, 255)"> <div style=3D"margin: 0px"> <div style=3D"margin: 0px"> <div style=3D"margin: 0px; font-size: 12pt; font-family: Calibri, Arial, He= lvetica, sans-serif; color: black; background-color: white"> As you might want different API's for your python module than your cpp libr= ary, it is not needed to define it (as private or at all) in cpp. As long a= s you define it as private in the SIP file.</div> <div style=3D"margin: 0px; font-size: 12pt; font-family: Calibri, Arial, He= lvetica, sans-serif; color: black; background-color: white"> <br> Matthijs</div> </div> </div> </div> <div> <div id=3D"Signature"> <div> <div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt; color:#000000; ba= ckground-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif"> </div> <div> <div style=3D"font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12p= t; color:rgb(0,0,0);"> <br> <hr tabindex=3D"-1" style=3D"display:inline-block; width:98%;"> <b>Van:</b> Jochen Sprickerhof<br> <b>Verzonden:</b> Vrijdag, 26 Juni, 2020 16:32<br> <b>Aan:</b> Phil Thompson<br> <b>CC:</b> [email protected]<br> <b>Onderwerp:</b> Re: SIP v4.19.23 adds dependency on assignment operator <div><br> </div> </div> <div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;= "> <div class=3D"PlainText">* Phil Thompson <[email protected]>= ; [2020-06-26 15:28]:<br> >>* Phil Thompson <[email protected]> [2020-06-26 14:= 46]:<br> >>>So you need to tell SIP this by defining a private assignment <= br> >>>operator.<br> >><br> >>I tried that but SIP still generates code that is refused by gcc:<b= r> >><br> >>orocos_kdl/src/chainiksolvervel_pinv_givens.hpp:<br> >><br> >>+ private:<br> >>+ ChainIkSolver= Vel_pinv_givens& operator=3D(const<br> >>ChainIkSolverVel_pinv_givens& other);<br> >><br> >>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:<br> >><br> >>extern "C" {static void<br> >>dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper *);}<br> >>static void dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper <= br> >>*sipSelf)<br> >>{<br> >> if (sipIsDerivedClass(sipSelf))<br> >> reinterpret_cast<sipC= hainIkSolverVel_pinv_givens<br> >>*>(sipGetAddress(sipSelf))->sipPySelf =3D SIP_NULLPTR;<br> >><br> >> if (sipIsOwnedByPython(sipSelf))<br> >> {<br> >> release_ChainIkSolverVel= _pinv_givens(sipGetAddress(sipSelf),<br> >>sipIsDerivedClass(sipSelf));<br> >> }<br> >>}<br> >><br> >>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp: In function =91void<= br> >>assign_ChainIkSolverVel_pinv_givens(void*, Py_ssize_t, void*)=92:<b= r> >>python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:1047:137: error:<br> >>=91KDL::ChainIkSolverVel_pinv_givens&<br> >>KDL::ChainIkSolverVel_pinv_givens::operator=3D(const<br> >>KDL::ChainIkSolverVel_pinv_givens&)=92 is private within this c= ontext<br> >> 1047 | if (sipIsDerivedClass(sipSelf))<br> >><br> >>Do you have an idea why?<br> ><br> >You'll have to send me the relevant .sip files.<br> <br> Not sure what you need but there is a PR trying to implement this here:<br> <br> <a href=3D"https://github.com/orocos/orocos_kinematics_dynamics/pull/269" t= arget=3D"_blank" rel=3D"noopener noreferrer" data-auth=3D"NotApplicable">ht= tps://github.com/orocos/orocos_kinematics_dynamics/pull/269</a><br> <br> >>Also, the assignment operator is already removed by the compiler,<b= r> >>having to manually define it private sounds superfluous.<br> ><br> >SIP isn't a full C++ parser - it doesn't know that the compiler= will <br> >delete the operator.<br> <br> Yeah, I guessed so already.<br> </div> </span></font></div> </div> </div> </div> </div> </body> </html> --_000_AM0PR09MB3443FF554400127ED4F672FDA2900AM0PR09MB3443eurp_--