-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
gh-93691: fix too broad source locations of for statement iterators #120330
Conversation
Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…tors (pythonGH-120330) (cherry picked from commit 97b69db) Co-authored-by: Irit Katriel <[email protected]>
Sorry, @iritkatriel, I could not cleanly backport this to
|
GH-120399 is a backport of this pull request to the 3.13 branch. |
…t iterators (pythonGH-120330). (cherry picked from commit 97b69db) Co-authored-by: Irit Katriel <[email protected]>
|
hi @iritkatriel, I integraded the bytecode changes into executing and was confused why the source-ranges changed for for-loops but not for comprehensions? 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 Is there a reason for this or have they simply been forgotten? |
That a different story. Let's reopen the issue or create a new one for compressions. |
New issue: #123142 |
Before this PR the error location covers the entire for-block (with body).