pylint #89838 pypy compatibility [validation pending]

In pypy, the __builtins__ object is always a module. This is considered to be an implementation detail, and it's generally recommended to only use the 'builtins' object.

pylint$ hg diff
diff -r c6cbb867a882 checkers/utils.py
--- a/checkers/utils.py Thu Feb 23 09:26:58 2012 +0100
+++ b/checkers/utils.py Mon Mar 12 16:07:42 2012 -0700
@@ -96,7 +96,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 = vars(builtins).copy()
SPECIAL_BUILTINS = ('__builtins__',) # '__path__', '__file__')

def is_builtin(name): # was is_native_builtin

In pypy, object.__delattr__ is a member, but has no co_filename.

logilab/astng$ hg diff
diff -r 0272006bdfbe raw_building.py
--- a/raw_building.py Thu Jan 19 17:02:39 2012 +0100
+++ b/raw_building.py Mon Mar 12 15:19:36 2012 -0700
@@ -240,10 +240,14 @@
member = member.im_func
if isfunction(member):
# verify this is not an imported function
- if member.func_code.co_filename != getattr(self._module, '__file__', None):
+ filename = getattr(member.func_code, 'co_filename', None)
+ if filename is None:
+ assert isinstance(member, object)
+ object_build_methoddescriptor(node, member, name)
+ elif filename != getattr(self._module, '__file__', None):
attach_dummy_node(node, name, member)
- continue
- object_build_function(node, member, name)
+ else:
+ object_build_function(node, member, name)
elif isbuiltin(member):
if self.imported_member(node, member, name):
#if obj is object:

prioritynormal
typebug
done in0.25.2
load left0.000
closed by#0fc805bbfbe3 Fix checkers.utils for other implementations (use of __builtins__). Closes #99139. Closes #89838. Theses fixes need fixes on logilab-astng and logilab-common