Review Request 109684: Make code python3 compatible.

Luca Beltrame lbeltrame at kde.org
Sat Mar 23 23:37:18 UTC 2013



> On March 23, 2013, 11:35 p.m., Luca Beltrame wrote:
> > The issue is much deeper than this specific piece of code. In fact, fixing this part will not make the code Py3 compatible. The real problematic code is in PyKDE4, to be precise the kpythonpluginfactory (kpythonpluginfactory/ directory in PyKDE4) which is at the moment Py2 only. If that can be adjusted (I have no idea if it can, since I'm amateur at best at C++) then we can think about making plasma and such Py3 compatible.

I would be in favor of using eval, BTW. I would like to have Py2/Py3 compatibility (the rest of PyKDE4 is in fact fully Py3 compliant).


- Luca


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109684/#review29772
-----------------------------------------------------------


On March 23, 2013, 11:12 p.m., Michael Jansen wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109684/
> -----------------------------------------------------------
> 
> (Updated March 23, 2013, 11:12 p.m.)
> 
> 
> Review request for Plasma and Luca Beltrame.
> 
> 
> Description
> -------
> 
> Make code python3 compatible.
> 
> From the python 2.7 docs:
> 
>   The form exec(expr, globals) is equivalent to exec expr in globals, while
>   the form exec(expr, globals, locals) is equivalent to exec expr in globals,
>   locals. The tuple form of exec provides compatibility with Python 3, where
>   exec is a function rather than a statement
> 
> 
> But this only work with python 2.7. Version up to 2.6 do not have this behavior so i fully expect this review request to be rejected. But i wanted to open the discussion because its not easy to fix.
> 
> The syntax needed for version <= 2.6  is incompatible with versions >3.0 and no amount of code wizardry will help us here. We either require python 2.7 or have to duplicate, configure or whatever this script to match the python version used on build time. Or perhaps refactor the code to use eval?
> 
> Which way to go?
> 
> 
> Diffs
> -----
> 
>   plasma/generic/scriptengines/python/plasma_importer.py dae245aea1ea1d17c907ba9c12c7d06cc9e59b77 
> 
> Diff: http://git.reviewboard.kde.org/r/109684/diff/
> 
> 
> Testing
> -------
> 
> Not much yet. Works with 3.0 but i have no clue what that code does or how to test it.
> 
> 
> Thanks,
> 
> Michael Jansen
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130323/d903db99/attachment.html>


More information about the Plasma-devel mailing list