1. 23 Oct, 2019 1 commit
    • Francis Herne's avatar
      Initial Python 3.8 support. · e23fa8f1
      Francis Herne authored
      This allows kdev-python to be built and run against CPython 3.8,
       and if so to parse files containing 3.8 syntax.
      
      BUG: 411956
      FIXED-IN: 5.5.0
      e23fa8f1
  2. 02 Aug, 2019 1 commit
  3. 24 Oct, 2018 1 commit
  4. 10 Oct, 2018 1 commit
  5. 25 Aug, 2018 1 commit
  6. 07 Jul, 2018 1 commit
  7. 14 Feb, 2018 1 commit
  8. 21 Sep, 2017 1 commit
    • Francis Herne's avatar
      Parser: Normalize exception before reading values · 836545d1
      Francis Herne authored
      The Python C-API is weird here. By calling PyErr_NormalizeException,
       we get an instance of SyntaxError (or its subclass IndentationError)
       as the value instead of a plain tuple, which makes things clearer.
      
      Another effect is that we get the "Missing parentheses in call
       to 'print'" message when relevant instead of just "invalid syntax".
      836545d1
  9. 20 Sep, 2017 1 commit
  10. 18 Sep, 2017 1 commit
  11. 16 Sep, 2017 2 commits
  12. 15 Aug, 2017 1 commit
  13. 07 Aug, 2017 1 commit
  14. 12 May, 2017 1 commit
    • Friedrich W. H. Kossebau's avatar
      Default to disabled debug log on Q_LOGGING_CATEGORY calls · 6cd5cbfc
      Friedrich W. H. Kossebau authored
      This removes the need to call QLoggingCategory::setFilterRules()
      in the program code to default to disabled debug type log
      without any other settings.
      The latter has disadvantages, as it shadows any settings done
      in qtlogging.ini config files by the user
      (e.g. via kdebugsettings), thus enabling runtime control only
      via QT_LOGGING_CONF/QT_LOGGING_RULES, which is not that
      comfortable with lots of categories.
      
      Also use ECMQtDeclareLoggingCategory for less manual code
      6cd5cbfc
  15. 01 May, 2017 1 commit
    • Sven Brauch's avatar
      fix crash · 6043407c
      Sven Brauch authored
      This loop is obviously wrong, it iterates over size()+1 indices 0..size(),
      but there are only size().
      
      BUG:378827
      6043407c
  16. 08 Apr, 2017 1 commit
  17. 23 Mar, 2017 1 commit
  18. 17 Mar, 2017 1 commit
  19. 07 Mar, 2017 2 commits
  20. 05 Mar, 2017 2 commits
  21. 04 Mar, 2017 3 commits
    • Francis Herne's avatar
      Restore compile-time support for Python 3.4.3+ · f75c3b74
      Francis Herne authored
      Since 6d0b7646 (~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.
      
      No new tests. No test changes with Python 3.5+.
      All tests pass with 3.4 except those using newer syntax.
      
      Differential Revision: https://phabricator.kde.org/D4936
      f75c3b74
    • Francis Herne's avatar
      Use QT_VERSION_CHECK instead · c342c91c
      Francis Herne authored
      c342c91c
    • Francis Herne's avatar
      Simplify the #if check for Python version · e5fde908
      Francis Herne authored
      CMake only allows Python 3.x, and the previous check would fail for
       Python 4.0-4.5 anyway. Not sure what I was thinking when I typed that.
      e5fde908
  22. 31 Jan, 2017 1 commit
  23. 18 Jan, 2017 1 commit
  24. 10 Jan, 2017 1 commit
  25. 06 Jan, 2017 1 commit
  26. 04 Jan, 2017 1 commit
    • Francis Herne's avatar
      Don't visit child nodes of JoinedStringAst (py3.6 fstrings) · 275775c1
      Francis Herne authored
      The ranges and contexts are very broken, which triggers an assertion in
       child comprehension nodes.
      
      Overall expression value is always str, and expressions used in format
       strings ought to be simple, so we shouldn't miss much duchain info.
      
      This would break tooltips/highlighting for the child expressions, but
       that wasn't working anyway.
      275775c1
  27. 01 Jan, 2017 1 commit
    • Francis Herne's avatar
      Yet more range fixes. · 458f6433
      Francis Herne authored
      RangeUpdateVisitor was only run after completion of RangeFixVisitor.
      
      When RangeFixVisitor modified both a node and a non-parent ancestor of
       that node, the ranges of the intermediate nodes weren't updated and so
       the ancestor's fix didn't take the previous fix into account.
      Move the functionality of RangeUpdateVisitor into RangeFixVisitor so
       changes are propagated in time.
      
      There was a bug in the `findString` regex that prevented it working for
       empty strings. Switch to QRegularExpression (I should have used it
       originally) and use a better regex.
      
      Correct the ranges of byte and (python36) f-string literals, in addition
       to normal strings.
      The 'b'/'f' still isn't coloured, but afaik that's KSyntaxHighlighting.
      
      Hack comprehensions, lists and tuples in a similar way to subscripts;
       far from reliable, but ok for single-line expressions following PEP-8.
      
      CCBUG: 373850
      458f6433
  28. 29 Dec, 2016 1 commit
    • Francis Herne's avatar
      PEP-448 unpacking in dict literals. · fde31d65
      Francis Herne authored
      ```
      foo = {'a': 2}
      bar = {**foo}
      ```
      Previously, `foo` would incorrectly be added to the value type of `bar`.
      
      N.B. this allows Ast::DictAst::keys to contain null values (for unpacked
       dicts, where there is no key). This is necessary to determine which
       values should be unpacked, because the value node has no different
       properties.
      
      No test regressions. Two new tests previously failed, now pass.
      
      Differential Revision: https://phabricator.kde.org/D3867
      fde31d65
  29. 25 Dec, 2016 4 commits
    • Francis Herne's avatar
      Remove unneeded null checks. · 0b39ae52
      Francis Herne authored
      In `reopenFittingDeclaration()`, we know the contents of `declarations`
       don't include any null values (all the way from
       `findLocalDeclarationsInternal()`).
      
      In `visitSubscript()`, `->slice` and `->slice->value` are initialised
      when the AST is generated, they can't be null if the parser succeeded.
      
      In `findNext()`, we call it only from `visitAttribute()`, where `node`
       is always true. Subsequently, values are checked in the loop before
       assigning them to `parent`.
      
      Above found by Nicolás with clang-analyzer. Notably, each was
       dereferenced without a check elsewhere, so we'd have had crashes if they
       really could be null somehow.
      
      The three AstBuilder::visitFoo() ones  were added by me this morning for
       no reason whatsoever while trying to set a buggiest-patch record.
      0b39ae52
    • Francis Herne's avatar
      ...and remove qWarning spam. · 248a951d
      Francis Herne authored
      Coding while distracted and slightly drunk is a bad idea. No more
       patches today.
      248a951d
    • Francis Herne's avatar
      Fix previous commit · d95905bd
      Francis Herne authored
      Compiler doesn't like `auto` there; allow for either "" or '' quotes.
      
      Hard to focus today, sorry...
      d95905bd
    • Francis Herne's avatar
      Set mostly-correct endCol on numbers, single-quoted strings and subscripts. · 20499383
      Francis Herne authored
      Before, endCol of number/string literals was identical to startCol;
       endCol of subscripts was the end of their slice node. This caused
       highlighting glitches when trying to position things after them.
      
      Unaddressed:
       - Triple-quoted (particularly multiline) strings. This gets length 2
          (inc. quotes) or does nothing, which is no worse than at present.
         Such strings are very unusual inside expressions where we care about
         the length.
      
       - Space between the end of a slice and the closing bracket of a
         subscript: `a = b[ 2 ]`. Recommended against by PEP-8, but happens.
      
      This should fix most remaining examples of bug 373850.
      CCBUG: 373850
      20499383
  30. 23 Dec, 2016 1 commit
    • Francis Herne's avatar
      Restore compile-time support for Python 3.5 · 1af1f30f
      Francis Herne authored
      Python 3.5 is default on Ubuntu 16.04 LTS and 16.10, Mint 18 and
       other commonly-used distros; we probably shouldn't drop it yet.
      
      AST nodes in 3.6 seem to be a superset of those in 3.5, and no other
       changes (discovered so far?) affect kdev-python. Simply skipping the
       generating code for new AST types will allow compilation against 3.5.
      
      Add a new `SINCE` directive in python36.sdef, e.g. `SINCE 3.6`, and
       make conversionGenerator.py emit #if checks for affected statements.
      
      This can't be used with `CODE`, because that wasn't needed yet. (:P)
      
      The bundled `FindPython` CMake module doesn't handle multiple Python
       versions. Instead use `FindPythonInterp` and `FindPythonLibs` from
       upstream CMake, which (without EXACT) will find newer versions than the
       one requested; the existing check ensures the version isn't too new.
      
      Put #if statements around the new tests, too.
      
      Differential Revision: https://phabricator.kde.org/D3804
      1af1f30f
  31. 30 Nov, 2016 2 commits
    • Kevin Funk's avatar
      Streamline logging categories · 7eb15adf
      Kevin Funk authored
      7eb15adf
    • Francis Herne's avatar
      Show uses for __call__() and __{get,set}item__() · 94ab1eee
      Francis Herne authored
      Uses of __getitem__() and __setitem__() weren't shown at all.
      Uses of __call__() were incorrectly shown as uses of __init__().
      
      This removes ExpressionAst::belongsToCall, because it's always equal to
       ExpressionAst::parent or null.
      
      This adds a new parameter `isAlias` to functionForCalled(), which allows
       it to distinguish between calling a class object (constructor __init__)
       and calling an instance of that class with __call__().
      
      This parameter can (and probably should) be used in other callers to
       improve parsing or just simplify code. For now, the default value of
       `true` causes functionForCalled() to behave as before.
      
      The ranges for these uses - as with the existing __init__() ones - are
       not always correct, particularly following subscripts.
      TODO: make the ranges of AST nodes more reliable, and then look more
       carefully for opening braces.
      
      No test regressions. No new tests, because the test framework doesn't
        seem to support use ranges currently.
      Tested on some real projects, didn't crash.
      
      Differential Revision: https://phabricator.kde.org/D3512
      94ab1eee