Commit Graph

89 Commits

Author SHA1 Message Date
Mathieu Virbel 9a18e94aa9 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.
2013-09-10 11:03:55 +02:00
Mathieu Virbel 04c8ced2a7 Merge branch 'master' of github.com:kivy/pyjnius 2013-08-17 19:14:04 +02:00
Mathieu Virbel 8541c489ff make sure that GetObjectArrayElement are freed. 2013-08-17 19:13:49 +02:00
Max Shabalihin d226263174 fix NotImplemented not found 2013-08-12 17:26:44 +04:00
Mathieu Virbel 54097ccacb dont overload the type, or later if will failed as well. 2013-08-06 16:24:19 +02:00
Michał Zieliński 35c410e542 fix lookup_java_object_name local reference leak 2013-08-02 14:14:50 +02:00
Michał Zieliński d6a3d1cf5f Delete local reference after constructing class 2013-08-01 22:38:27 +02:00
Michał Zieliński 2df76cb7f6 Check for exception after calling constructor 2013-08-01 21:25:20 +02:00
Mathieu Virbel 481b3e5d30 basic support for output args. works only in the original type allow slice assignment. We gently ignore TypeError if the assignation didnt work. closes #58 2013-07-02 09:43:39 +02:00
Mathieu Virbel 5ff62b146e last fixes to make pyjnius Java-thread proof. If you call any jnius related from a C thread, it will leak and/or crash (this hasnt been tested). 2013-06-25 11:49:42 +02:00
Mathieu Virbel 21d365df24 XXX avoid to switch between thread when invoke0 is called / new push_jnienv/pop_jnienv. Without it, if another thread use pyjnius = crash. (i have explored TLS storage for storing j_env, but it seems not available on Android. 2013-06-25 00:08:24 +02:00
Mathieu Virbel 3db9a76ed8 class: fix thread issues when using a class between thread (j_cls MUST be a global ref to work.) 2013-06-24 22:07:31 +02:00
Mathieu Virbel 8349037dd3 jnius: fix push/pop jnienv in order to avoid GIL going on using the previous thread env while we are still on the current thread 2013-06-24 18:36:58 +02:00
Mathieu Virbel 5bf97da477 jnius: refactor to not save jni env, and use the current pushed/pop env. This resolve few issues when pyjnius is called from a proxy (error such as E/dalvikvm( 6036): JNI ERROR: env->self != thread-self (0x68415860 vs. 0x400bb010); auto-correcting) 2013-06-24 17:58:20 +02:00
Mathieu Virbel 2c5a14dae2 fix encoding issues in test_implementation.py 2013-06-24 09:36:31 +02:00
Mathieu Virbel 5ec6d80ba3 accept python string as a valid argument for [B and [C 2013-06-24 09:21:40 +02:00
Mathieu Virbel 3fe55c1bb2 Allow to pass None for array (example: String[] can be null.) 2013-06-23 15:46:25 +02:00
Mathieu Virbel ded2378679 Add __javacontext__ for proxy class, which can be either "system" or "app". Default goes to system if non existent.
Also check the exception before trying to convert the returned value, as i've experienced, sometimes the value returned is not NULL, but is not valid at all, cause an exception happen.
2013-04-28 19:15:25 +02:00
Mathieu Virbel 1844de341e add a better repr for LocalRef class (ie, indicate the source reference we came from.) 2013-04-28 19:14:14 +02:00
Mathieu Virbel 4cf0b865b9 cython 0.19 fixes, jlong was interpreted as a number, not as a pointer value anymore. 2013-04-28 19:13:23 +02:00
Mathieu Virbel abc36192c3 fix tests 2013-03-24 18:49:31 -05:00
Mathieu Virbel 242245a6f4 proxy: force GIL on invoke0, and add a special case for $Proxy name (android failed to FindClass) 2013-03-24 18:45:33 -05:00
Mathieu Virbel 2a95adc674 cleanup proxy code 2013-03-13 21:38:10 +01:00
Mathieu Virbel a1c18107d3 add DEBUG boolean in the java class 2013-03-13 19:12:53 +01:00
Mathieu Virbel 717c0166cf reduce code 2013-03-13 19:12:40 +01:00
Mathieu Virbel 46555de7b2 implement void return 2013-03-13 19:12:33 +01:00
Mathieu Virbel 0686d6b54b ident java 2013-03-13 18:53:39 +01:00
Mathieu Virbel ac94b7c815 fix crash in Java, it look like changing CreateLocalRef to CreateGlobalRef works, and retain correctly some references needed for the invocation. But i'm not entirely sure about the implication. 2013-03-13 18:53:25 +01:00
tshirtman 7068b37d69 fix classpath for windows and CLASSPATH definition 2013-01-03 13:12:40 +01:00
tshirtman e10ed056bb move testImpl to tests/test_proxy.py and move NativeInvocationHandler
adapt jnius_jvm_desktop to have access to java jnius package
2013-01-03 12:57:46 +01:00
tshirtman be312974f3 fix issue with int/long not being accepted as Object in conversion
not sure it's the best fix, but seems to fix it
2013-01-03 01:45:52 +01:00
tshirtman 208806f635 add support for multiple signatures, add various tests 2013-01-03 01:19:49 +01:00
Mathieu Virbel a2d0076e56 added convert_python_to_jobject: don't do convert to java primitive/jvalue, but jobject. fixed array translation. 2013-01-02 18:11:12 +01:00
Mathieu Virbel 143ab371b6 more work on the proxy, better argument conversion. shuffle() works on array <= 3. with 9 argument, it seem to call toArray(), and argument conversion is not great for [I 2013-01-02 13:57:08 +01:00
Mathieu Virbel 8915e9d558 debug 2013-01-02 12:18:44 +01:00
Mathieu Virbel 9838ac9282 fix for always returning an Object from invoke(). If it's a native primitive, create the corresponding native java.lang.<type>.
The current conversion is only for: int (java.lang.Long), bool (java.lang.Boolean), float (java.lang.Double).
+ remove debug
2013-01-02 12:18:30 +01:00
Mathieu Virbel f12abcbc88 add auto conversion for java.lang.Long/Integer/Float/Double/Short/Boolean/Byte/Character 2013-01-02 12:16:51 +01:00
Mathieu Virbel dcfe369f1e various fix for java/python implementation. It finally start working, but still lot to do.
Use: make testimplem, and check the jnius/jnius_utils.pxi:test() function.
2012-12-31 05:15:09 +01:00
tshirtman 9b758a81c3 some clarifications for java classes extended support 2012-12-31 00:15:25 +01:00
Gabriel 5d143331a8 put NativeInvocationHandler in jnius java package 2012-12-25 01:07:59 +01:00
Gabriel 21a6e0d4ce some progress on proxy/invocation handler for wrapping python classes in java 2012-12-25 01:07:00 +01:00
Gabriel 70fa391458 Merge branch 'master' into extend_class_support 2012-12-23 17:02:17 +01:00
Mathieu Virbel f03dfdf886 -always- release the arrays, whatever is the iscopy boolean. According to the documentation, "The result is valid until the corresponding Release<PrimitiveType>ArrayElements() function is called". The iscopy boolean serve just for another case: "Since the returned array may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until Release<PrimitiveType>ArrayElements() is called.Since the returned array may be a copy of the Java array, changes made to the returned array will not necessarily be reflected in the original array until Release<PrimitiveType>ArrayElements() is called." 2012-12-21 03:52:59 +01:00
Amirouche Boubekki fcfb1e64a8 added support for Python class as parameter of java methods that takes Java Class object as parameter 2012-10-14 23:00:19 +02:00
Amirouche Boubekki c216057647 convert arrays returned as Java Object to python list 2012-10-01 02:20:58 +02:00
Amirouche Boubekki 4a6945accd convert list of integer, float and long to their equivalent Java Array object 2012-10-01 01:30:51 +02:00
Amirouche Boubekki 20b4bd5d62 allow to use python list and tuple as Object params 2012-10-01 01:21:24 +02:00
Amirouche Boubekki 78a68134ae no need to raise an exception here 2012-10-01 01:16:57 +02:00
Amirouche Boubekki b8ee0f8ab5 fix method resolution when they are varargs 2012-09-30 22:39:38 +02:00
Amirouche Boubekki c58de98b8a no need to recompute return and args definition 2012-09-30 21:50:19 +02:00