Restore compile-time support for Python 3.4.3+
ClosedPublic

Authored by flherne on Mar 4 2017, 7:05 PM.

Details

Summary

Since 6d0b764 (~5.0-beta1) the minimum Python version has been 3.5.0,
but OpenSUSE Leap want to use KDevelop 5 and still have Python 3.4.

There are major breaking changes between 3.4.2 and 3.4.3, so earlier
versions will not be supported.

Now supported are 3.4.3+, 3.5.x and 3.6.x.

Syntax from Python versions newer than the one kdev-python is compiled
against will not be recognised and will cause false-positive errors
to be displayed to users. Please use the most recent version unless
there are unavoidable reasons to use an older one.


In function calls:

  • 'stararg' is replaced by a StarredAst at the end of 'arguments'.
  • 'kwargs' is replaced by a KeywordAst at the end of 'keywords'.

A new CODE block in python36.sdef converts 3.4-style AST to the newer
format used by Python 3.5+ and within kdev-python. The conversion
script is tweaked to allow both CODE and SINCE on the same line, and
a new BEFORE directive (inverse of SINCE).

Operator @ (matmul) is inserted into the middle of the enum, so all
operators listed later have a different index.

All other AST changes are just new additions.

Test Plan

No new tests. No test changes with Python 3.5+.
All tests pass with 3.4 except those using newer syntax.

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
flherne created this revision.Mar 4 2017, 7:05 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptMar 4 2017, 7:05 PM
brauch accepted this revision.Mar 4 2017, 8:03 PM

Nice work, looks good to me -- didn't test with 3.4 though. Thank you very much!

duchain/tests/pyduchaintest.cpp
997 ↗(On Diff #12169)

Can we use QT_VERSION_CHECK or so such that this doesn't break for Python 4? ;)

This revision is now accepted and ready to land.Mar 4 2017, 8:03 PM
This revision was automatically updated to reflect the committed changes.
flherne marked an inline comment as done.