diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2016-12-18 15:07:07 +0200 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-12-30 13:30:55 +0200 |
| commit | 3e1e0f0784a2ea46099b92d87d7d8ff6458da547 (patch) | |
| tree | ca2f6c26956f5b42267c3d2638e04e04f33c8493 | |
| parent | 4cecab0e15d5ed84cdc8f26a372069ce2189eba7 (diff) | |
| download | astroid-git-3e1e0f0784a2ea46099b92d87d7d8ff6458da547.tar.gz | |
Raise AstroidTypeError whenever a slice cannot be inferred, instead of raising TypeError and letting the upper context to handle it.
| -rw-r--r-- | astroid/tree/node_classes.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/astroid/tree/node_classes.py b/astroid/tree/node_classes.py index d52cb2ca..dca84db1 100644 --- a/astroid/tree/node_classes.py +++ b/astroid/tree/node_classes.py @@ -71,7 +71,9 @@ def _infer_slice(node, context=None): if all(elem is not _SLICE_SENTINEL for elem in (lower, upper, step)): return slice(lower, upper, step) - raise TypeError('Could not infer slice used in subscript.') + raise exceptions.AstroidTypeError( + message='Could not infer slice used in subscript', + node=node, index=node.parent, context=context) def _container_getitem(instance, elts, index, context=None): |
