Bug 349990 - kdev-python broken with Python 3.4.3
Summary: kdev-python broken with Python 3.4.3
Status: RESOLVED FIXED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: git master
Platform: Compiled Sources Linux
: VHI critical
Target Milestone: ---
Assignee: Sven Brauch
URL:
Keywords: release_blocker
: 350751 351147 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-07 08:58 UTC by Sven Brauch
Modified: 2015-10-12 10:23 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
attachment-18816-0.html (1.74 KB, text/html)
2015-10-10 18:52 UTC, Hai Zaar
Details
attachment-20469-0.html (1.66 KB, text/html)
2015-10-10 19:30 UTC, Hai Zaar
Details
attachment-22138-0.html (866 bytes, text/html)
2015-10-10 20:04 UTC, Hai Zaar
Details
attachment-17183-0.html (1.31 KB, text/html)
2015-10-12 10:03 UTC, Hai Zaar
Details
kdevelop.log.gz (19.61 KB, application/x-gzip)
2015-10-12 10:14 UTC, Hai Zaar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Brauch 2015-07-07 08:58:44 UTC
Since Python 3.4.3 reverted [1] a patch which was critical to how kdev-python works, it is severely broken with this version of Python; it causes crashes and wrong highlighting. A fix in kdev-python is being worked on, until that is released, downgrading to Python 3.4.2 or earlier is the only option.

_______________
[1] https://bugs.python.org/issue21295
Comment 1 Sven Brauch 2015-07-29 21:43:24 UTC
*** Bug 350751 has been marked as a duplicate of this bug. ***
Comment 2 Sven Brauch 2015-08-10 09:13:25 UTC
*** Bug 351147 has been marked as a duplicate of this bug. ***
Comment 3 Radek Novacek 2015-09-03 15:30:27 UTC
Can you please change required version in parser/CMakeLists.txt? It confused me - I compiled 3.4.3 from source because my distro provides 3.4.2 only. Now I see it would work better with 3.4.2.

Thank you.
Comment 4 Radek Novacek 2015-09-24 13:58:19 UTC
It seems that python 3.5.0 has some improvements in this area. At least the test cases in the python bug report (https://bugs.python.org/issue21295) seems to work correctly.

I'm unable to test kdev-python with python 3.5.0 because the compilation fails:
In file included from ../../parser/astbuilder.cpp:424:0:
../../parser/generated.h: In member function 'Python::Ast* Python::PythonAstTransformer::visitNode(_expr*)':
../../parser/generated.h:156:109: error: 'struct _expr::<anonymous union>::<anonymous>' has no member named 'kwargs'
                 nodeStack.push(v); v->keywordArguments = static_cast<ExpressionAst*>(visitNode(node->v.Call.kwargs)); nodeStack.pop();
Comment 5 Sven Brauch 2015-09-24 15:30:37 UTC
Hmm, is that related to the issue we have here?
The relevant thing is that in "foo.bar" the offset of "bar" must be 4, not 0.

Greetings!
Comment 6 Radek Novacek 2015-09-29 13:53:03 UTC
Ah, sorry, I'm not familiar with python ast module.

Is this more helpful?

>>> for x in ast.walk(ast.parse('foo.bar')):
...     if hasattr(x, 'col_offset'):
...         print("%s: %d" % (x, x.col_offset))
...
<_ast.Expr object at 0x7fcdc84722b0>: 0
<_ast.Attribute object at 0x7fcdc84723c8>: 0
<_ast.Name object at 0x7fcdc8472438>: 0
Comment 7 Sven Brauch 2015-09-29 16:40:28 UTC
Yes, that is the point. And for our purpose the second one would need to be 4, not 0.
Comment 8 Sven Brauch 2015-10-07 14:37:55 UTC
Should be fixed in master and the tip of the 1.7-py3 branch. I'll do a release of the latter shortly.
Comment 9 Hai Zaar 2015-10-10 18:52:03 UTC
Created attachment 94936 [details]
attachment-18816-0.html

Many thanks for fixing this. I'm trying to test it and run into two issues:
1. It requires kdevplatform-1.7.2, but Google knows nothing about this new
version (the latest is 1.7.1).
2. I have Python 3.4.3 compiled from sources in a custom dir (using pyenv),
how do I tell cmake to use it instead of system python3?



On Wed, Oct 7, 2015 at 5:37 PM, Sven Brauch <mail@svenbrauch.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=349990
>
> Sven Brauch <mail@svenbrauch.de> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>              Status|CONFIRMED                   |RESOLVED
>          Resolution|---                         |FIXED
>
> --- Comment #8 from Sven Brauch <mail@svenbrauch.de> ---
> Should be fixed in master and the tip of the 1.7-py3 branch. I'll do a
> release
> of the latter shortly.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 10 Sven Brauch 2015-10-10 18:55:30 UTC
You can change the requirement to 1.7.1 in CMakeLists.txt, it doesn't really need that. The release will happen in a few days.

For a custom path to python, I am not sure, but in ccmake you can set it manually; the key is PYTHON_LIBRARY so you could try -DPYTHON_LIBRARY=path/to/libpython.so maybe?
Comment 11 Hai Zaar 2015-10-10 19:30:33 UTC
Created attachment 94937 [details]
attachment-20469-0.html

What worked for me is specifying PYTHON_EXEC. Found it out after
discovering modules under cmake directory in the source.

Here is the cmake command line for future reference:
~/dev/kdev-python/build$ cmake
-DPYTHON_EXEC=~/.pyenv/versions/3.4.3/bin/python ../

Otherwise I've tested it briefly and it looks very good! Thank you very
much!

Any plans for supporting Python 3.5? Particularly new "async def" and
"await" keywords?


On Sat, Oct 10, 2015 at 9:55 PM, Sven Brauch <mail@svenbrauch.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=349990
>
> --- Comment #10 from Sven Brauch <mail@svenbrauch.de> ---
> You can change the requirement to 1.7.1 in CMakeLists.txt, it doesn't
> really
> need that. The release will happen in a few days.
>
> For a custom path to python, I am not sure, but in ccmake you can set it
> manually; the key is PYTHON_LIBRARY so you could try
> -DPYTHON_LIBRARY=path/to/libpython.so maybe?
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 12 Sven Brauch 2015-10-10 20:00:31 UTC
That's already implemented in master, I do not plan to backport it to 1.7 though. :)
Comment 13 Hai Zaar 2015-10-10 20:04:07 UTC
Created attachment 94938 [details]
attachment-22138-0.html

And master works only with upcoming kdevelop 5, right? Do you have any idea
of its planned release date?
On Oct 10, 2015 11:00 PM, "Sven Brauch" <mail@svenbrauch.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=349990
>
> --- Comment #12 from Sven Brauch <mail@svenbrauch.de> ---
> That's already implemented in master, I do not plan to backport it to 1.7
> though. :)
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 14 Sven Brauch 2015-10-10 20:04:43 UTC
Yes, exactly.
A stable release should happen within "a few months", probably.
Comment 15 Hai Zaar 2015-10-12 10:03:44 UTC
Created attachment 94964 [details]
attachment-17183-0.html

I think there is regression:

Most of system imports do not work:
Try any of these:

import collections as _collections
import copy as _copy
import os as _os
import re as _re
import sys as _sys
import textwrap as _textwrap

None of them would be recognized.

On Sat, Oct 10, 2015 at 11:04 PM, Sven Brauch <mail@svenbrauch.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=349990
>
> --- Comment #14 from Sven Brauch <mail@svenbrauch.de> ---
> Yes, exactly.
> A stable release should happen within "a few months", probably.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 16 Sven Brauch 2015-10-12 10:04:39 UTC
Which version are you using now exactly? Also, are you sure the background parser has finished?
Comment 17 Hai Zaar 2015-10-12 10:14:18 UTC
Created attachment 94965 [details]
kdevelop.log.gz

Branch 1.7-py3 HEAD.

Attached is kdevelop log with debug enabled for parsing the following file:

import collections as _collections
import copy as _copy
import os as _os
import re as _re
import sys as _sys
import textwrap as _textwrap

I've did it on fresh project containing only this file and after cleaning
~/.cache/kdevduchain/ dir.



On Mon, Oct 12, 2015 at 1:04 PM, Sven Brauch <mail@svenbrauch.de> wrote:

> https://bugs.kde.org/show_bug.cgi?id=349990
>
> --- Comment #16 from Sven Brauch <mail@svenbrauch.de> ---
> Which version are you using now exactly? Also, are you sure the background
> parser has finished?
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 18 Sven Brauch 2015-10-12 10:23:33 UTC
Let's continue this in the other report ;)