D7908: Parser: Normalize exception before reading values

Francis Herne noreply at phabricator.kde.org
Thu Sep 21 10:07:24 UTC 2017


flherne created this revision.
flherne added a reviewer: brauch.
Restricted Application added a subscriber: kdevelop-devel.

REVISION SUMMARY
  The Python  C-API is pretty 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".

TEST PLAN
  Parsing valid files still works, parsing broken files doesn't crash, and in case of python2 'print' or 'exec' statements we display the more detailed error.

REPOSITORY
  R53 KDevelop: Python Support

REVISION DETAIL
  https://phabricator.kde.org/D7908

AFFECTED FILES
  parser/astbuilder.cpp

To: flherne, brauch
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170921/306497f4/attachment-0001.html>


More information about the KDevelop-devel mailing list