Bug 411956 - Fails to build against Python 3.8
Summary: Fails to build against Python 3.8
Status: RESOLVED FIXED
Alias: None
Product: kdev-python
Classification: Developer tools
Component: Language support (show other bugs)
Version: git master
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: Francis Herne
URL:
Keywords:
Depends on:
Blocks: 419290
  Show dependency treegraph
 
Reported: 2019-09-16 08:54 UTC by Jan Grulich
Modified: 2020-08-19 21:31 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.5.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Grulich 2019-09-16 08:54:11 UTC
There is a new version of Python coming to Fedora 32 and it seems that kdev-python is not able to build against this new version.

See Fedora bug: https://bugzilla.redhat.com/show_bug.cgi?id=1705544
Comment 1 Francis Herne 2019-09-19 11:20:52 UTC
As usual, the ast API in 3.8 has incompatible changes.

I'm looking at it now.
Comment 2 David Geiger 2019-10-03 04:31:51 UTC
Same issue here on Mageia Cauldron with Python 3.8.
Comment 3 Francis Herne 2019-10-23 14:12:04 UTC
Git commit e23fa8f15af89a8bd4bd84dd96b5fd7017457516 by Francis Herne.
Committed on 23/10/2019 at 14:08.
Pushed by flherne into branch 'master'.

Initial Python 3.8 support.

This allows kdev-python to be built and run against CPython 3.8,
 and if so to parse files containing 3.8 syntax.
FIXED-IN: 5.5.0

M  +2    -2    CMakeLists.txt
M  +9    -1    duchain/declarationbuilder.cpp
M  +1    -0    duchain/declarationbuilder.h
M  +4    -0    duchain/expressionvisitor.cpp
M  +1    -0    duchain/expressionvisitor.h
M  +19   -0    duchain/tests/pyduchaintest.cpp
M  +6    -1    parser/ast.cpp
M  +9    -0    parser/ast.h
M  +6    -0    parser/astbuilder.cpp
M  +6    -0    parser/astdefaultvisitor.cpp
M  +2    -0    parser/astdefaultvisitor.h
M  +1    -0    parser/astvisitor.cpp
M  +1    -0    parser/astvisitor.h
M  +7    -4    parser/conversionGenerator.py
M  +36   -0    parser/generated.h
R  +49   -6    parser/python38.sdef [from: parser/python36.sdef - 082% similarity]
M  +5    -0    parser/tests/pyasttest.cpp

https://invent.kde.org/kde/kdev-python/commit/e23fa8f15af89a8bd4bd84dd96b5fd7017457516
Comment 4 Francis Herne 2019-10-23 14:18:43 UTC
Note: the patch linked also applies cleanly against 5.4.x, pending a 5.5 release.

Testing now.
Comment 5 David Geiger 2019-10-26 04:29:50 UTC
Confirmed on Mageia Cauldron that now kdev-python build against python 3.8.

Thanks!
Comment 6 John 2019-11-02 21:33:24 UTC
The PyKDE4 documentation (khtml.py and kdecore.py) still contain invalid syntax for python 3.8


kdevelop-python-5.4.2_2: configuring ...
Byte-compiling python code in usr/share/kdevpythonsupport...
*** Error compiling 'usr/share/kdevpythonsupport/documentation_files/PyKDE4/kdecore.py'...
  File "usr/share/kdevpythonsupport/documentation_files/PyKDE4/kdecore.py", line 315
    def setExecutesAsync(self, async):
                               ^
SyntaxError: invalid syntax

*** Error compiling 'usr/share/kdevpythonsupport/documentation_files/PyKDE4/khtml.py'...
  File "usr/share/kdevpythonsupport/documentation_files/PyKDE4/khtml.py", line 1622
    def async(self):
        ^
SyntaxError: invalid syntax


And a bunch of warnings for others:

usr/share/kdevpythonsupport/documentation_files/numpy.py:33741: SyntaxWarning: 'NoneType' object is not callable; perhaps you missed a comma?
  return None()
Comment 7 Francis Herne 2020-08-19 21:31:47 UTC
Those files should not be byte-compiled.

They are never intended to be executed; kdev-python parses them as-is to provide information about the relevant modules.

Compiling or executing them in any other way will not do anything useful and may cause problems.