-
-
Notifications
You must be signed in to change notification settings - Fork 307
Closed
Labels
Description
Steps to reproduce
import astroid
node = astroid.extract_node("[][::0]")
print(next(node.infer()))Current behavior
Traceback (most recent call last):
File "repro.py", line 3, in <module>
print(next(node.infer()))
File ".../astroid/nodes/node_ng.py", line 169, in infer
yield from self._infer(context=context, **kwargs)
File ".../astroid/decorators.py", line 140, in raise_if_nothing_inferred
yield next(generator)
File ".../astroid/decorators.py", line 109, in wrapped
for res in _func(node, context, **kwargs):
File ".../astroid/inference.py", line 440, in infer_subscript
assigned = value.getitem(index_value, context)
File ".../astroid/nodes/node_classes.py", line 3499, in getitem
return _container_getitem(self, self.elts, index, context=context)
File ".../astroid/nodes/node_classes.py", line 232, in _container_getitem
new_cls.elts = elts[index_slice]
ValueError: slice step cannot be zeroOriginally spotted in pylint with a minimal reproducer like:
for _ in [][::0]:
passExpected behavior
Uninferable
python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output
(venv) $ python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
2.13.0-dev0
(venv) $ git rev-parse HEAD
1a074cf66fc4fdb6714fac7afb14f9e7457cd704