summaryrefslogtreecommitdiff
path: root/astroid/helpers.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-06-03 15:44:31 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2016-06-03 16:00:53 +0100
commit3e27213914271309a4716662b09fda91fca9efa1 (patch)
tree716d375804c63ea58c65f2e27a0d6350e537f6b9 /astroid/helpers.py
parent119c8c6a70a166283b2f0cd5cfa18b45d8592ab9 (diff)
downloadastroid-git-3e27213914271309a4716662b09fda91fca9efa1.tar.gz
Now is_subtype / is_supertype raises an internal exception when a type hierarchy can't be determined
It used to return Uninferable, but no call site was actually taking care of this potential return. It is better though to simply raise an exception and to let the call sites to handle them in which way they want to.
Diffstat (limited to 'astroid/helpers.py')
-rw-r--r--astroid/helpers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/astroid/helpers.py b/astroid/helpers.py
index 76261730..25b378f8 100644
--- a/astroid/helpers.py
+++ b/astroid/helpers.py
@@ -126,7 +126,7 @@ def has_known_bases(klass, context=None):
def _type_check(type1, type2):
if not all(map(has_known_bases, (type1, type2))):
- return util.Uninferable
+ raise exceptions._NonDeducibleTypeHierarchy
if not all([type1.newstyle, type2.newstyle]):
return False
@@ -134,7 +134,7 @@ def _type_check(type1, type2):
return type1 in type2.mro()[:-1]
except exceptions.MroError:
# The MRO is invalid.
- return util.Uninferable
+ raise exceptions._NonDeducibleTypeHierarchy
def is_subtype(type1, type2):