proxy: add "except *" to correctly propagate the python exception in invoke0, and let traceback print it. (python exception doesn't go through java... ^^).

+ avoid double-referencing in proxy. Before, we was having weird issue without it, but i'm not able to trigger it right now. Do the clean way.
This commit is contained in:
Mathieu Virbel 2013-09-10 11:03:55 +02:00
parent 04c8ced2a7
commit 9a18e94aa9
1 changed files with 1 additions and 3 deletions

View File

@ -73,14 +73,13 @@ cdef class PythonJavaClass(object):
return py_method(*args) return py_method(*args)
cdef jobject py_invoke0(JNIEnv *j_env, jobject j_this, jobject j_proxy, jobject cdef jobject py_invoke0(JNIEnv *j_env, jobject j_this, jobject j_proxy, jobject
j_method, jobjectArray args) with gil: j_method, jobjectArray args) except * with gil:
from .reflect import get_signature, Method from .reflect import get_signature, Method
cdef jfieldID ptrField cdef jfieldID ptrField
cdef jlong jptr cdef jlong jptr
cdef object py_obj cdef object py_obj
cdef JavaClass method cdef JavaClass method
cdef LocalRef ref
cdef jobject j_arg cdef jobject j_arg
# get the python object # get the python object
@ -91,7 +90,6 @@ cdef jobject py_invoke0(JNIEnv *j_env, jobject j_this, jobject j_proxy, jobject
# extract the method information # extract the method information
method = Method(noinstance=True) method = Method(noinstance=True)
ref = create_local_ref(j_env, j_method)
method.instanciate_from(create_local_ref(j_env, j_method)) method.instanciate_from(create_local_ref(j_env, j_method))
ret_signature = get_signature(method.getReturnType()) ret_signature = get_signature(method.getReturnType())
args_signature = [get_signature(x) for x in method.getParameterTypes()] args_signature = [get_signature(x) for x in method.getParameterTypes()]