Skip to content

Source locations too broad for list comprehension iterable expression #123142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iritkatriel opened this issue Aug 19, 2024 · 2 comments
Closed
Assignees
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@iritkatriel
Copy link
Member

iritkatriel commented Aug 19, 2024

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

@iritkatriel iritkatriel added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Aug 19, 2024
@iritkatriel iritkatriel self-assigned this Aug 19, 2024
@JelleZijlstra JelleZijlstra changed the title Source locations too broad for list comprehension utterable expression Source locations too broad for list comprehension iterable expression Aug 19, 2024
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 20, 2024
…tions from broken iterables in comprehensions
@Eclips4 Eclips4 added 3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes and removed needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Aug 20, 2024
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 21, 2024
…tions from broken iterables in comprehensions
iritkatriel added a commit that referenced this issue Aug 21, 2024
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 21, 2024
…f exceptions from broken iterables in comprehensions (pythonGH-123173).

(cherry picked from commit ec89620)

Co-authored-by: Irit Katriel <[email protected]>
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 21, 2024
…f exceptions from broken iterables in comprehensions (pythonGH-123173).

(cherry picked from commit ec89620)

Co-authored-by: Irit Katriel <[email protected]>
blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
iritkatriel added a commit that referenced this issue Aug 22, 2024
…ptions from broken iterables in comprehensions (GH-123173). (#123209)

(cherry picked from commit ec89620)
iritkatriel added a commit that referenced this issue Aug 22, 2024
…ptions from broken iterables in comprehensions (GH-123173). (#123210)

(cherry picked from commit ec89620)
@picnixz
Copy link
Member

picnixz commented Aug 22, 2024

Closing since completed in #123173 and backported.

@iritkatriel
Copy link
Member Author

See #123173 (comment)

iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 28, 2024
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 28, 2024
…AITER (pythonGH-123420).

(cherry picked from commit 61bef62)

Co-authored-by: Irit Katriel <[email protected]>
iritkatriel added a commit to iritkatriel/cpython that referenced this issue Aug 28, 2024
…AITER (pythonGH-123420).

(cherry picked from commit 61bef62)

Co-authored-by: Irit Katriel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes 3.13 bugs and security fixes 3.14 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants