File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,20 @@ def test_list():
243243 # instead of a JS exception.
244244 self .context .eval ("test_list()" )
245245
246+ def test_python_exception_with_object_return_does_not_raise_system_error (self ):
247+ # https://github.com/PetterS/quickjs/issues/66
248+
249+ def python_raise ():
250+ raise Exception
251+
252+ self .context .add_callable ("python_raise" , python_raise )
253+ # When called, `a` should return an object (a promise),
254+ # even though a Python error is generated in the background.
255+ self .context .eval ("async function a() {await python_raise();}" )
256+ # With incorrect error handling, this raised a SystemError in dev builds,
257+ # and segfaulted in prod builds.
258+ self .assertEqual (self .context .eval ("typeof a();" ), "object" )
259+
246260
247261class Object (unittest .TestCase ):
248262 def setUp (self ):
You can’t perform that action at this time.
0 commit comments