[pylucene-dev] Python exception not always generated for Java RuntimeException
Andi Vajda
vajda at osafoundation.org
Thu Nov 6 17:23:07 PST 2008
On Thu, 6 Nov 2008, Andi Vajda wrote:
>> I suspect the difference is that I was building in non-shared mode.
>>
>> The underlying code is in JCCEnv::reportException()
>>
>> if (vm_env->IsSameObject(cls, _thr))
>> throw pythonError(throwable);
>>
>> and above, if _jcc_lib isn't defined:
>>
>> _thr = (jclass) vm_env->NewGlobalRef(vm_env->FindClass("java/lang/RuntimeException"));
>>
>> and then macros.h returns NULL when it catches a pythonError.
>>
>> Andi, I presume you're building with shared? I'll try that, but it might
>> be nice to clear this up for non-shared builds.
>
> Ahhh, I understand now. I can't just assume that all RuntimeError instances
> are python errors. That's the problem.
The fix looks surprisingly simple: check if a python error happened first.
Andi..
More information about the pylucene-dev
mailing list