[pylucene-dev] can't override QueryParser.parse()

Andi Vajda vajda at osafoundation.org
Tue Nov 13 18:25:21 PST 2007


On Tue, 13 Nov 2007, Bill Janssen wrote:

>>> This kind of has me stymied.  I don't call getJavaException()
>>> anywhere, so it must be the call in jcc/jcc/cpp.py that's signalling this
>>> exception, which means it's catching a JavaError which doesn't have
>>> this method.  How can that happen?
>>
>> I don't know. If you send me code to reproduce the problem, I can probably
>> tell you more.
>
> I recompiled with -g and ran under gdb.  What's happening is that the line
> in jcc/sources/functions.cpp:throwPythonError() that reads
>
>        PyErr_Fetch(&exc, &value, &traceback);
>
> is returning, as "value", a Throwable, not a JavaError:

Then, I'm confused as to what the 'exc' object is. My understanding of 
PyErr_Fetch() is that 'exc' is the error class, which is checked against 
PyExc_JavaError, a python class that's supposed to have a method on it called 
getJavaException() which in turn returns the actual Java Throwable instance, 
and 'value' is the actual error instance. The docs [1] are not very explicit.
Calling getJavaException() on a Throwable makes no sense.

Again, if you send me code that reproduces the problem, I can make more sense 
and fix the bug, if there is one.

Andi..

[1] http://docs.python.org/api/exceptionHandling.html#l2h-97


More information about the pylucene-dev mailing list