GH-103488: Use return-offset, not yield-offset. (GH-103502)

* Use return-offset, not yield-offset, so that instruction pointer is correct when sending to a generator or coroutine.
This commit is contained in:
Mark Shannon 2023-04-13 16:19:07 +01:00 committed by GitHub
parent 4307feaddc
commit efb8a2553c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 455 additions and 414 deletions

View file

@ -225,7 +225,22 @@ class GeneratorTest(unittest.TestCase):
gi = f()
self.assertIsNone(gi.gi_frame.f_back)
def test_issue103488(self):
def gen_raises():
yield
raise ValueError()
def loop():
try:
for _ in gen_raises():
if True is False:
return
except ValueError:
pass
#This should not raise
loop()
class ExceptionTest(unittest.TestCase):
# Tests for the issue #23353: check that the currently handled exception