gh-93691: fix too broad source locations of for statement iterators#120330
gh-93691: fix too broad source locations of for statement iterators#120330iritkatriel merged 5 commits intopython:mainfrom
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 <1055913+iritkatriel@users.noreply.github.com>
|
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 <1055913+iritkatriel@users.noreply.github.com>
|
|
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
^^^^^
AssertionErrorIs 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).