From 83a9a00cf368bd5baa9d505e19f4b8bd7735a190 Mon Sep 17 00:00:00 2001 From: Peter Badida Date: Thu, 31 Jan 2019 19:09:56 +0100 Subject: [PATCH] Always check for exception JavaClass.call_constructor() --- jnius/jnius_export_class.pxi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jnius/jnius_export_class.pxi b/jnius/jnius_export_class.pxi index 128c6d3..a42a4bd 100644 --- a/jnius/jnius_export_class.pxi +++ b/jnius/jnius_export_class.pxi @@ -348,6 +348,10 @@ cdef class JavaClass(object): self.j_self = create_local_ref(j_env, j_self) j_env[0].DeleteLocalRef(j_env, j_self) finally: + # in case NewObjectA() throws an exception, + # the execution might not get further, but 'finally' block + # will still be called + check_exception(j_env) if j_args != NULL: free(j_args)