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: &quot;Segoe UI&quo=
t;, &quot;Segoe UI Web (West European)&quot;, &quot;Segoe UI&quot;, -apple-=
system, BlinkMacSystemFont, Roboto, &quot;Helvetica Neue&quot;, 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 &lt;[email protected]&gt=
; [2020-06-26 15:28]:<br>
&gt;&gt;* Phil Thompson &lt;[email protected]&gt; [2020-06-26 14:=
46]:<br>
&gt;&gt;&gt;So you need to tell SIP this by defining a private assignment <=
br>
&gt;&gt;&gt;operator.<br>
&gt;&gt;<br>
&gt;&gt;I tried that but SIP still generates code that is refused by gcc:<b=
r>
&gt;&gt;<br>
&gt;&gt;orocos_kdl/src/chainiksolvervel_pinv_givens.hpp:<br>
&gt;&gt;<br>
&gt;&gt;&#43;&nbsp;&nbsp;&nbsp;&nbsp; private:<br>
&gt;&gt;&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChainIkSolver=
Vel_pinv_givens&amp; operator=3D(const<br>
&gt;&gt;ChainIkSolverVel_pinv_givens&amp; other);<br>
&gt;&gt;<br>
&gt;&gt;python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:<br>
&gt;&gt;<br>
&gt;&gt;extern &quot;C&quot; {static void<br>
&gt;&gt;dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper *);}<br>
&gt;&gt;static void dealloc_ChainIkSolverVel_pinv_givens(sipSimpleWrapper <=
br>
&gt;&gt;*sipSelf)<br>
&gt;&gt;{<br>
&gt;&gt;&nbsp;&nbsp;&nbsp; if (sipIsDerivedClass(sipSelf))<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reinterpret_cast&lt;sipC=
hainIkSolverVel_pinv_givens<br>
&gt;&gt;*&gt;(sipGetAddress(sipSelf))-&gt;sipPySelf =3D SIP_NULLPTR;<br>
&gt;&gt;<br>
&gt;&gt;&nbsp;&nbsp;&nbsp; if (sipIsOwnedByPython(sipSelf))<br>
&gt;&gt;&nbsp;&nbsp;&nbsp; {<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; release_ChainIkSolverVel=
_pinv_givens(sipGetAddress(sipSelf),<br>
&gt;&gt;sipIsDerivedClass(sipSelf));<br>
&gt;&gt;&nbsp;&nbsp;&nbsp; }<br>
&gt;&gt;}<br>
&gt;&gt;<br>
&gt;&gt;python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp: In function =91void<=
br>
&gt;&gt;assign_ChainIkSolverVel_pinv_givens(void*, Py_ssize_t, void*)=92:<b=
r>
&gt;&gt;python_orocos_kdl/PyKDL/sip/sipPyKDLpart1.cpp:1047:137: error:<br>
&gt;&gt;=91KDL::ChainIkSolverVel_pinv_givens&amp;<br>
&gt;&gt;KDL::ChainIkSolverVel_pinv_givens::operator=3D(const<br>
&gt;&gt;KDL::ChainIkSolverVel_pinv_givens&amp;)=92 is private within this c=
ontext<br>
&gt;&gt; 1047 |&nbsp;&nbsp;&nbsp;&nbsp; if (sipIsDerivedClass(sipSelf))<br>
&gt;&gt;<br>
&gt;&gt;Do you have an idea why?<br>
&gt;<br>
&gt;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>
&gt;&gt;Also, the assignment operator is already removed by the compiler,<b=
r>
&gt;&gt;having to manually define it private sounds superfluous.<br>
&gt;<br>
&gt;SIP isn't a full C&#43;&#43; parser - it doesn't know that the compiler=
 will <br>
&gt;delete the operator.<br>
<br>
Yeah, I guessed so already.<br>
</div>
</span></font></div>
</div>
</div>
</div>
</div>
</body>
</html>

--_000_AM0PR09MB3443FF554400127ED4F672FDA2900AM0PR09MB3443eurp_--