@@ -839,9 +839,16 @@ def test_bad_script(self):
839839interp.exec(10)
840840841841deftest_bytes_for_script(self):
842+r, w=self.pipe()
843+RAN=b'R'
844+DONE=b'D'
842845interp=interpreters.create()
843-withself.assertRaises(TypeError):
844-interp.exec(b'print("spam")')
846+interp.exec(f"""if True:
847+ import os
848+ os.write({w}, {RAN!r})
849+ """)
850+os.write(w, DONE)
851+self.assertEqual(os.read(r, 1), RAN)
845852846853deftest_with_background_threads_still_running(self):
847854r_interp, w_interp=self.pipe()
@@ -1010,8 +1017,6 @@ def test_call(self):
1010101710111018fori, (callable, args, kwargs) inenumerate([
10121019 (call_func_noop, (), {}),
1013- (call_func_return_shareable, (), {}),
1014- (call_func_return_not_shareable, (), {}),
10151020 (Spam.noop, (), {}),
10161021 ]):
10171022withself.subTest(f'success case #{i+1}'):
@@ -1036,6 +1041,8 @@ def test_call(self):
10361041 (call_func_complex, ('custom', 'spam!'), {}),
10371042 (call_func_complex, ('custom-inner', 'eggs!'), {}),
10381043 (call_func_complex, ('???',), {'exc': ValueError('spam')}),
1044+ (call_func_return_shareable, (), {}),
1045+ (call_func_return_not_shareable, (), {}),
10391046 ]):
10401047withself.subTest(f'invalid case #{i+1}'):
10411048withself.assertRaises(Exception):
@@ -1051,8 +1058,6 @@ def test_call_in_thread(self):
1051105810521059fori, (callable, args, kwargs) inenumerate([
10531060 (call_func_noop, (), {}),
1054- (call_func_return_shareable, (), {}),
1055- (call_func_return_not_shareable, (), {}),
10561061 (Spam.noop, (), {}),
10571062 ]):
10581063withself.subTest(f'success case #{i+1}'):
@@ -1079,6 +1084,8 @@ def test_call_in_thread(self):
10791084 (call_func_complex, ('custom', 'spam!'), {}),
10801085 (call_func_complex, ('custom-inner', 'eggs!'), {}),
10811086 (call_func_complex, ('???',), {'exc': ValueError('spam')}),
1087+ (call_func_return_shareable, (), {}),
1088+ (call_func_return_not_shareable, (), {}),
10821089 ]):
10831090withself.subTest(f'invalid case #{i+1}'):
10841091ifargsorkwargs:
@@ -1618,8 +1625,8 @@ def test_exec(self):
16181625deftest_call(self):
16191626withself.subTest('no args'):
16201627interpid=_interpreters.create()
1621-exc=_interpreters.call(interpid, call_func_return_shareable)
1622-self.assertIs(exc, None)
1628+withself.assertRaises(ValueError):
1629+_interpreters.call(interpid, call_func_return_shareable)
1623163016241631withself.subTest('uncaught exception'):
16251632interpid=_interpreters.create()