Commits

Antonio Cuni  committed f8c673f

fix for pypy, look at the comment for the details; this makes syntax highlighting working inside IDLE

  • Participants
  • Parent commits 4b91858

Comments (0)

Files changed (1)

File lib-python/modified-2.7.0/idlelib/Delegator.py

         self.__cache[name] = attr
         return attr
 
+    def __nonzero__(self):
+        # this is needed for PyPy: else, if self.delegate is None, the
+        # __getattr__ above picks NoneType.__nonzero__, which returns
+        # False. Thus, bool(Delegator()) is False as well, but it's not what
+        # we want.  On CPython, bool(Delegator()) is True because NoneType
+        # does not have __nonzero__
+        return True
+
     def resetcache(self):
         for key in self.__cache.keys():
             try: