Re: [Jython-dev] Using PyChecker in Jython

Hi. [Neal Norwitz]
As easy as making PyChecker working on source code without using dis and without importing/executing modules and their top defs, I think there will be no dis support on jython side (we produce java bytecode and getting "back" to python vm bytecode would be very tricky, not very elegant, etc. ) any time soon <wink>. Seriously, two possible workaround hacks (they are also not very easy), this is just after small brainstorming and ignoring the concrete needs and code of PyChecker: +) more elegant one, but maybe still too difficult or requiring too much work: let PyChecker run under CPython even when checking jython code, jython code can compile down to py vm bytecode but then does not run: why? java classes imports and the jython specific builtin modules (not so many) So one needs to implement a sufficient amount of python (an import hook, etc) code that does the minimal partial evalution required and the required amount of loading&introspection on java, jython specific stuff in order to have the imports work and PyChecher feeded with the things it needs. This means dealing with the java class format, or a two passes approach: run the code under jython in order to gather the information needed to load it succesfully under python. If the top level code contains conditionals that depend on jython stuff this could be hard, but one can ignore that (at least for starting). Clearly the main PyChecker loop would require some adaptation, and maybe include some logic to check some jython specific stuff (subclassing from java, etc). *) let an adapted PyChecker run under jython, obtain someway the needed py vm bytecode stream from a source -> py vm bytecode compiler written in python (such a thing exists - if I remember well) . And similar ideas ... regards, Samuele Pedroni.
participants (1)
-
Samuele Pedroni