summaryrefslogtreecommitdiff
path: root/pylint/checkers/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/utils.py')
-rw-r--r--pylint/checkers/utils.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 4581c7849..726e0e367 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -1530,18 +1530,13 @@ def get_iterating_dictionary_name(
def get_subscript_const_value(node: astroid.Subscript) -> astroid.Const:
"""
- Returns the value (subscript.slice) of a Subscript node,
- also supports python <3.9 windows where node.slice might be an Index
- node
+ Returns the value 'subscript.slice' of a Subscript node.
:param node: Subscript Node to extract value from
:returns: Const Node containing subscript value
:raises InferredTypeError: if the subscript node cannot be inferred as a Const
"""
- value = node.slice
- if isinstance(value, astroid.Index):
- value = value.value
- inferred = safe_infer(value)
+ inferred = safe_infer(node.slice)
if not isinstance(inferred, astroid.Const):
raise InferredTypeError(
"Subscript.slice cannot be inferred as an astroid.Const"