Dang, hate it when I do that. Here is the patch.
Also, I realized I had made a change to my local jython posixpath module to
work around issue 99139 but I forgot about it (I think it was the same
thing) so that is still an issue.
As for supporting Jython I did notice a glaring issue that it is not able
to pick up/resolve modules loaded from a jar file (including any built-in
classes like java.lang.String). This appeared to be choking inside one of
the the astng modules but didn't have time to look too closely.
Thanks,
-Brandon
On Jul 6, 2012 12:37 AM, "Sylvain Thénault" <[email protected]>
wrote:
> Hi,
>
> On 05 juillet 14:23, Brandon Pedersen wrote:
> > Attaching a patch that will allow pylint to use the standard
> > __builtin__ module rather than the implementation specific
> > __builtins__ variable.
>
> No patch attached
>
> > All tests pass when applied to the previous stable release (0.25.1).
>
> Good to know :)
>
> > This patch addresses parts of issues from supporting other
> > interpreters (PyPy and Jython) see http://www.logilab.org/ticket/99139
> > and http://www.logilab.org/ticket/89838
> >
> > Several tests still fail under Jython but this at least allows PyLint
> > to run under Jython for the most part (I was not able to reproduce the
> > other part of issue 99139)
>
> That would be great if pylint worked with jython, pypy, ironpython. I'll
> try
> to release pylint/astng releases fixing related tickets ASAP. So many
> thanks
> for anyhelp on this. I have missed #89838 which already contains a patch,
> let's begin by applying this.
>
> Cheers,
> --
> Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse
> (09.54.03.55.76)
> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> Développement logiciel sur mesure: http://www.logilab.fr/services
> CubicWeb, the semantic web framework: http://www.cubicweb.org
>
diff -r b91be9d00e50 checkers/utils.py
--- a/checkers/utils.py Thu Jun 07 16:55:09 2012 +0200
+++ b/checkers/utils.py Thu Jul 05 14:08:38 2012 -0600
@@ -24,6 +24,7 @@
from logilab.astng import scoped_nodes
from logilab.common.compat import builtins
BUILTINS_NAME = builtins.__name__
+import __builtin__
COMP_NODE_TYPES = astng.ListComp, astng.SetComp, astng.DictComp, astng.GenExpr
@@ -113,7 +114,7 @@
"""return true if the given node does nothing but 'pass'"""
return len(body) == 1 and isinstance(body[0], astng.Pass)
-builtins = __builtins__.copy()
+builtins = __builtin__.__dict__.copy()
SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__')
def is_builtin(name): # was is_native_builtin
diff -r b91be9d00e50 lint.py
--- a/lint.py Thu Jun 07 16:55:09 2012 +0200
+++ b/lint.py Thu Jul 05 14:08:38 2012 -0600
@@ -34,6 +34,7 @@
import os
import re
import tokenize
+import __builtin__
from warnings import warn
from logilab.common.configuration import UnsupportedAction, OptionsManagerMixIn
@@ -708,9 +709,9 @@
# this may help to import modules using gettext
try:
- __builtins__._ = str
+ __builtin__._ = str
except AttributeError:
- __builtins__['_'] = str
+ __builtin__['_'] = str
class ArgumentPreprocessingError(Exception):
diff -r b91be9d00e50 test/unittest_checkers_utils.py
--- a/test/unittest_checkers_utils.py Thu Jun 07 16:55:09 2012 +0200
+++ b/test/unittest_checkers_utils.py Thu Jul 05 14:08:38 2012 -0600
@@ -20,12 +20,13 @@
import unittest
import sys
+import __builtin__
from pylint.checkers import utils
try:
- __builtins__.mybuiltin = 2
+ __builtin__.mybuiltin = 2
except AttributeError:
- __builtins__['mybuiltin'] = 2
+ __builtin__['mybuiltin'] = 2
class UtilsTC(unittest.TestCase):
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects