Message8213

Author tlecomte
Recipients tlecomte
Date 2013-12-24.15:19:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387898347.21.0.513484263325.issue2108@psf.upfronthosting.co.za>
In-reply-to
Content
Dear all,

I would like to run pyflakes under Jython (to do live syntax analysis on Python files inside an editor written in Java).

Unfortunately, pyflakes does not run with Jython. When running the following inside Jython:

    from pyflakes.api import check
    check("a = 1", "untitled.py")

I get the following:

Traceback (most recent call last):
  File "/Users/tlecomte/Documents/20131224_pyflakes/test_pyflakes.py", line 2, in <module>
    check("a = 1", "untitled.py")
  File "/Users/tlecomte/Src/icy-git/Icy-App/plugins/Lib/site-packages/pyflakes/api.py", line 58, in check
    w = checker.Checker(tree, filename)
  File "/Users/tlecomte/Src/icy-git/Icy-App/plugins/Lib/site-packages/pyflakes/checker.py", line 253, in __init__
    self.handleChildren(tree)
  File "/Users/tlecomte/Src/icy-git/Icy-App/plugins/Lib/site-packages/pyflakes/checker.py", line 520, in handleChildren
    self.handleNode(node, tree)
  File "/Users/tlecomte/Src/icy-git/Icy-App/plugins/Lib/site-packages/pyflakes/checker.py", line 551, in handleNode
    node.level = self.nodeDepth
AttributeError: '_ast.Assign' object has no attribute 'level'



Note that pyflakes tries to set a new attribute on 'node', which is a '_ast.Assign' object, i.e. subclass of _ast.AST and PythonTree. These are java classes deriving from PyObject and do not have a __dict__.

Under CPython, _ast.AST() shows the same behaviour, BUT all its subclasses (including '_ast.Assign') seem to allow the setting of new attributes. So it would be great if it was the same under Jython.

I am willing to help, but I am afraid I do not understand well enough the inner workings of PyObject in Jython...

Best regards,

Timothée
History
Date User Action Args
2013-12-24 15:19:07tlecomtesetrecipients: + tlecomte
2013-12-24 15:19:07tlecomtesetmessageid: <1387898347.21.0.513484263325.issue2108@psf.upfronthosting.co.za>
2013-12-24 15:19:07tlecomtelinkissue2108 messages
2013-12-24 15:19:05tlecomtecreate