10000 GH-94262: Don't create frame objects for frames that aren't complete. by markshannon · Pull Request #94371 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-94262: Don't create frame objects for frames that aren't complete. #94371

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

Merged
merged 11 commits into from
Jul 1, 2022
Next Next commit
Add test for creating frame object when making a generator.
  • Loading branch information
markshannon committed Jun 27, 2022
commit 87e97ae4ad8942bc0cc09174d8964c3e02b6b03b
15 changes: 15 additions & 0 deletions Lib/test/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,21 @@ def f():
g.send(0)
self.assertEqual(next(g), 1)

def test_handle_frame_object_in_creation(self):

def cb(*args):
try:
sys._getframe(1)
except ValueError:
pass

gc.set_threshold(1, 0, 0)
gc.callbacks.append(cb)

def gen():
yield 1

gen()

class ExceptionTest(unittest.TestCase):
# Tests for the issue #23353: check that the currently handled exception
Expand Down
0