summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2007-02-18 11:27:16 +0100
committerSylvain Thénault <sylvain.thenault@logilab.fr>2007-02-18 11:27:16 +0100
commit51539300dbf6071c963acab72ecb7e52ee5c4e21 (patch)
tree7d37270d56cdecaca8076c9f639d32200d5c8f30
parentc8b757cdfdcc7542214698fd4c9f1072ae54bf3f (diff)
downloadastroid-git-51539300dbf6071c963acab72ecb7e52ee5c4e21.tar.gz
fix an infinite recursion bug
-rw-r--r--scoped_nodes.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scoped_nodes.py b/scoped_nodes.py
index 6ea56041..43d929e6 100644
--- a/scoped_nodes.py
+++ b/scoped_nodes.py
@@ -30,7 +30,7 @@ __doctype__ = "restructuredtext en"
import sys
-from logilab.common.compat import chain
+from logilab.common.compat import chain, set
from logilab.astng.utils import extend_class
from logilab.astng import YES, MANAGER, Instance, copy_context, \
@@ -483,15 +483,21 @@ class ClassNG(object):
ancestors only
"""
# FIXME: should be possible to choose the resolution order
+ # XXX inference make infinite loops possible here (see BaseTransformer
+ # manipulation in the builder module for instance !)
for stmt in self.bases:
try:
for baseobj in stmt.infer(context):
if not isinstance(baseobj, Class):
# duh ?
continue
+ if baseobj is self:
+ continue # cf xxx above
yield baseobj
if recurs:
for grandpa in baseobj.ancestors(True, context):
+ if baseobj is self:
+ continue # cf xxx above
yield grandpa
except InferenceError:
#import traceback