[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Review Request: Tidy up Python 3 support.
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2012-11-20 23:10:11
Message-ID: CAHAc2jdgPavt_SOC4SZ=huVU9btEE2yJX-AOc9i33r3+9di_-A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Luca, All,

So, this ends up being MUCH more complicated than I thought because not
only did the API change between Python 2 and 3, it also changed between 3.2
and 3.3. The primary references I used are:

    Python 2.x. http://docs.python.org/2/c-api/unicode.html
    Python 3.2 or less.
http://docs.python.org/3.2/c-api/unicode.html#unicode-objects
    Python 3.3 or greater.
http://docs.python.org/3.3/c-api/unicode.html#unicode-objects

I have coded/tested 2.x, and coded up both 3.2 and 3.3. Python 3.2 has 3
compile-time variants (I think!) and 3.3 has 3 run-time variants (again, I
think!). I have no ability to test any of the 3.x code paths in the short
term, and therefore cannot test it either. I'll upload the diffs to
reviewboard, and it would be great if you could try it and let me know what
you find/think.

Thanks, Shaheed



On 20 November 2012 06:29, Luca Beltrame <lbeltrame@kde.org> wrote:

> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107391/
> kate/plugins/pate/src/utilities.cpp<http://git.reviewboard.kde.org/r/107391/diff/1/?file=95418#file95418line367> \
> (Diff revision 1)
> 
> bool Python::isUnicode(PyObject *string)
> 
> 355
> 
> return PyUnicode_AsUnicode(string);
> 
> This doesn't build on Python 3:
> 
> error: could not convert ‘PyUnicode_AsUnicode(string)' from ‘Py_UNICODE* {aka \
> wchar_t*}' to ‘QString' 
> 
> - Luca
> 
> On November 19th, 2012, 10:02 p.m., Shaheed Haque wrote:
> Review request for Kate and Luca Beltrame.
> By Shaheed Haque.
> 
> *Updated Nov. 19, 2012, 10:02 p.m.*
> Description
> 
> Tidy up Python 3 support by rationalising the #ifs contributed by Luca via \
> https://git.reviewboard.kde.org/r/107362/ 
> Testing
> 
> Compiled/tested with Python 2.
> 
> Diffs
> 
> - kate/plugins/pate/src/engine.cpp
> (487a8574ffb60eb2e846faa79cc9de529f39219c)
> - kate/plugins/pate/src/plugin.cpp
> (a1dfa4843a3efa3689d1543fc72bafe46ac1346a)
> - kate/plugins/pate/src/utilities.h
> (7edf71c83523354cfd5b9bda4a6d7de6e9e1c41d)
> - kate/plugins/pate/src/utilities.cpp
> (20e53a3abff47d99fdf37f435a963f4d714f8ac5)
> 
> View Diff <http://git.reviewboard.kde.org/r/107391/diff/>
> 


[Attachment #5 (text/html)]

Hi Luca, All,<div><br></div><div>So, this ends up being MUCH more complicated than I \
thought because not only did the API change between Python 2 and 3, it also changed \
between 3.2 and 3.3. The primary references I used are:</div> \
<div><br></div><div><div>      Python 2.x. <a \
href="http://docs.python.org/2/c-api/unicode.html">http://docs.python.org/2/c-api/unicode.html</a></div><div> \
Python 3.2 or less. <a \
href="http://docs.python.org/3.2/c-api/unicode.html#unicode-objects">http://docs.python.org/3.2/c-api/unicode.html#unicode-objects</a><br>
 </div><div>      Python 3.3 or greater. <a \
href="http://docs.python.org/3.3/c-api/unicode.html#unicode-objects">http://docs.pytho \
n.org/3.3/c-api/unicode.html#unicode-objects</a><br></div></div><div><br></div><div>I \
have coded/tested 2.x, and coded up both 3.2 and 3.3. Python 3.2 has 3 compile-time \
variants (I think!) and 3.3 has 3 run-time variants (again, I think!). I have no \
ability to test any of the 3.x code paths in the short term, and therefore cannot \
test it either. I&#39;ll upload the diffs to reviewboard, and it would be great if \
you could try it and let me know what you find/think.</div> \
<div><br></div><div>Thanks, Shaheed</div><div><br></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On 20 November 2012 06:29, Luca \
Beltrame <span dir="ltr">&lt;<a href="mailto:lbeltrame@kde.org" \
target="_blank">lbeltrame@kde.org</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">



 <div>
  <div style="font-family:Verdana,Arial,Helvetica,Sans-Serif"><div class="im">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border:1px #c9c399 \
solid">  <tbody><tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107391/" \
target="_blank">http://git.reviewboard.kde.org/r/107391/</a>  </td>
    </tr>
   </tbody></table>
   <br>









</div><div>




<table width="100%" border="0" bgcolor="white">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom:1px solid \
#c0c0c0;font-size:9pt;padding:4px 8px;text-align:left">  <a \
href="http://git.reviewboard.kde.org/r/107391/diff/1/?file=95418#file95418line367" \
style="text-decoration:underline;font-weight:bold" \
target="_blank">kate/plugins/pate/src/utilities.cpp</a>  <span \
style="font-weight:normal">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color:#e4d9cb;padding:4px 8px;text-align:center">
  <tr>

   <td colspan="2"><pre style="font-size:8pt;line-height:140%;margin:0"></pre></td>
   <td colspan="2"><pre style="font-size:8pt;line-height:140%;margin:0">bool \
Python::isUnicode(PyObject *string)</pre></td>

  </tr>
 </tbody>




 
 



 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right:1px solid #c0c0c0" \
align="right"><font></font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size:8pt;line-height:140%;margin:0"></pre></td>  <th bgcolor="#b1ebb0" \
style="border-left:1px solid #c0c0c0;border-right:1px solid #c0c0c0" \
align="right"><font>355</font></th>  <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size:8pt;line-height:140%;margin:0">    <span>return</span> \
<span>PyUnicode_AsUnicode</span><span>(</span><span>string</span><span>);</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left:2em;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word">This \
doesn&#39;t build on Python 3:

error: could not convert ‘PyUnicode_AsUnicode(string)' from ‘Py_UNICODE* {aka \
wchar_t*}' to ‘QString'</pre> </div>
<br>



<p>- Luca</p><div class="im">


<br>
<p>On November 19th, 2012, 10:02 p.m., Shaheed Haque wrote:</p>






</div><table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image:url(&#39;&#39;);background-repeat:repeat-x;border:1px black \
solid">  <tbody><tr>
  <td><div class="im">

<div>Review request for Kate and Luca Beltrame.</div>
<div>By Shaheed Haque.</div>


<p style="color:grey"><i>Updated Nov. 19, 2012, 10:02 p.m.</i></p>






<h1 style="color:#575012;font-size:10pt;margin-top:1.5em">Description </h1>
 </div><table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border:1px solid #b8b5a0">  <tbody><tr>
  <td>
   <pre style="margin:0;padding:0;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word">Tidy \
up Python 3 support by rationalising the #ifs contributed by Luca via <a \
href="https://git.reviewboard.kde.org/r/107362/" \
target="_blank">https://git.reviewboard.kde.org/r/107362/</a></pre>

  </td>
 </tr>
</tbody></table><div class="im">


<h1 style="color:#575012;font-size:10pt;margin-top:1.5em">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border:1px solid #b8b5a0">  <tbody><tr>
  <td>
   <pre style="margin:0;padding:0;white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word">Compiled/tested \
with Python 2.</pre>  </td>
 </tr>
</tbody></table>




<h1 style="color:#575012;font-size:10pt;margin-top:1.5em">Diffs </h1>
<ul style="margin-left:3em;padding-left:0">

 <li>kate/plugins/pate/src/engine.cpp <span \
style="color:grey">(487a8574ffb60eb2e846faa79cc9de529f39219c)</span></li>

 <li>kate/plugins/pate/src/plugin.cpp <span \
style="color:grey">(a1dfa4843a3efa3689d1543fc72bafe46ac1346a)</span></li>

 <li>kate/plugins/pate/src/utilities.h <span \
style="color:grey">(7edf71c83523354cfd5b9bda4a6d7de6e9e1c41d)</span></li>

 <li>kate/plugins/pate/src/utilities.cpp <span \
style="color:grey">(20e53a3abff47d99fdf37f435a963f4d714f8ac5)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107391/diff/" style="margin-left:3em" \
target="_blank">View Diff</a></p>




  </div></td>
 </tr>
</tbody></table>








  </div>
 </div>


</blockquote></div><br></div>



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic