mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-110514: Add PY_THROW to sys.setprofile
events (GH-110524)
This commit is contained in:
parent
9f8282de6b
commit
dd4bb0529e
3 changed files with 27 additions and 1 deletions
|
@ -255,6 +255,25 @@ class ProfileHookTestCase(TestCaseBase):
|
|||
(1, 'return', g_ident),
|
||||
])
|
||||
|
||||
def test_unfinished_generator(self):
|
||||
def f():
|
||||
for i in range(2):
|
||||
yield i
|
||||
def g(p):
|
||||
next(f())
|
||||
|
||||
f_ident = ident(f)
|
||||
g_ident = ident(g)
|
||||
self.check_events(g, [(1, 'call', g_ident),
|
||||
(2, 'call', f_ident),
|
||||
(2, 'return', f_ident),
|
||||
# once more; the generator is being garbage collected
|
||||
# and it will do a PY_THROW
|
||||
(2, 'call', f_ident),
|
||||
(2, 'return', f_ident),
|
||||
(1, 'return', g_ident),
|
||||
])
|
||||
|
||||
def test_stop_iteration(self):
|
||||
def f():
|
||||
for i in range(2):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue