Closed
Description
Bug report
Reported here: #120330 (comment)
class Foo:
def __iter__(self):
assert False
a = [x for x in Foo()]
output (Python 3.12.5):
Traceback (most recent call last):
File "/home/frank/projects/executing/codi.py", line 5, in <module>
a = [x for x in Foo()]
^^^^^^^^^^^^^^^^^^
File "/home/frank/projects/executing/codi.py", line 3, in __iter__
assert False
^^^^^
AssertionError
Linked PRs
- gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions #123173
- [3.13] gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (GH-123173). #123209
- [3.12] gh-123142: Fix too wide source locations in tracebacks of exceptions from broken iterables in comprehensions (GH-123173). #123210
- gh-123142: fix too wide source location of GET_ITER/GET_AITER #123420
- [3.13] gh-123142: fix too wide source location of GET_ITER/GET_AITER (GH-123420). #123435
- [3.12] gh-123142: fix too wide source location of GET_ITER/GET_AITER (GH-123420). #123436