Skip to content

Commit

Permalink
Fix TestInterpreterRun.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed Dec 12, 2023
1 parent d161f76 commit 778276f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Lib/test/test_interpreters/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,19 @@ def test_success(self):
self.assertEqual(out, 'it worked!')

def test_failure(self):
interp = interpreters.create()
t = interp.run('raise Exception')
t.join()
caught = False
def excepthook(args):
nonlocal caught
caught = True
threading.excepthook = excepthook
try:
interp = interpreters.create()
t = interp.run('raise Exception')
t.join()

self.assertTrue(caught)
except BaseException:
threading.excepthook = threading.__excepthook__


class TestIsShareable(TestBase):
Expand Down

0 comments on commit 778276f

Please sign in to comment.