[pypy-svn] pypy default: fix for pypy, look at the comment for the details; this makes syntax highlighting working inside IDLE
antocuni
commits-noreply at bitbucket.org
Tue Apr 19 13:21:04 CEST 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r43478:f8c673fee06d
Date: 2011-04-19 13:19 +0200
http://bitbucket.org/pypy/pypy/changeset/f8c673fee06d/
Log: fix for pypy, look at the comment for the details; this makes syntax
highlighting working inside IDLE
diff --git a/lib-python/modified-2.7.0/idlelib/Delegator.py b/lib-python/modified-2.7.0/idlelib/Delegator.py
--- a/lib-python/modified-2.7.0/idlelib/Delegator.py
+++ b/lib-python/modified-2.7.0/idlelib/Delegator.py
@@ -12,6 +12,14 @@
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:
More information about the Pypy-commit
mailing list