Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Commit fd0eddd

Browse files
committed
fix for pypy, look at the comment for the details; this makes syntax highlighting working inside IDLE
1 parent 9ddf56a commit fd0eddd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ def __getattr__(self, name):
1212
self.__cache[name] = attr
1313
return attr
1414

15+
def __nonzero__(self):
16+
# this is needed for PyPy: else, if self.delegate is None, the
17+
# __getattr__ above picks NoneType.__nonzero__, which returns
18+
# False. Thus, bool(Delegator()) is False as well, but it's not what
19+
# we want. On CPython, bool(Delegator()) is True because NoneType
20+
# does not have __nonzero__
21+
return True
22+
1523
def resetcache(self):
1624
for key in self.__cache.keys():
1725
try:

0 commit comments

Comments
 (0)