Skip to content

Commit 95bfb6a

Browse files
committed
Fix gregmalcolm#97 - remove debug code that causes infinite loop
Debug code in python2/koans/about_attribute access caused an infinite loop when run. It has been removed per the suggestions in the bug description. Also made the Python 3 version of this bit consistent with the Python 2 version by relocating a comment.
1 parent b61f2fb commit 95bfb6a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

python2/koans/about_attribute_access.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ def __init__(self):
105105
self.no_of_getattribute_calls = 0
106106

107107
def __getattribute__(self, attr_name):
108-
#Uncomment for debugging info:
109-
#print 'Debug __getattribute__(' + type(self).__name__ + \
110-
# "." + attr_name + ") dict=" + str(self.__dict__)
111-
112108
# We need something that is outside the scope of this class:
113109
global stack_depth
114110
stack_depth += 1

python3/koans/about_attribute_access.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def __init__(self):
9393
self.no_of_getattribute_calls = 0
9494

9595
def __getattribute__(self, attr_name):
96-
global stack_depth # We need something that is outside the scope of this class
96+
# We need something that is outside the scope of this class:
97+
global stack_depth
9798
stack_depth += 1
9899

99100
if stack_depth<=10: # to prevent a stack overflow

0 commit comments

Comments
 (0)