> > But I still have the problem reflected in the stack trace with GDB:
> > the "value" being extracted is not of the Python type JavaError (it's
> > of the Python type "Throwable"), and doesn't have the method
> > "getJavaException", while the "exc" *is* of type JavaError. Either
> > the code in PyErr_SetJavaError() isn't correct, or the code in
> > throwPythonError() isn't correct.
>
> The example code you sent me now runs fine. Did you rebuild JCC and PyLucene
> with the fix. If so, and you still have the problem, then the bug I fixed is
> different and I'd still need a piece of code from you that reproduces the
> problem you're still having.
That fixed my problem. Thanks!
> > PyErr_SetObject() basically just stores the three values you give it
> > in three thread-global slots; it doesn't create a new instance of type
> > "exc" and somehow assign "value" to a slot in that instance.
>
> That may be so but when it comes time to raise the actual exception and
> instantiate it, these three values are used to create an instance of
> JavaError
> whose data element is the actual wrapped java throwable.
You think! But it's done with this code (in
jcc/jcc/sources/functions.cpp:throwPythonError):
if (exc && PyErr_GivenExceptionMatches(exc, PyExc_JavaError))
{
PyObject *value, *traceback;
PyErr_Fetch(&exc, &value, &traceback);
if (value)
{
PyObject *je = PyObject_CallMethod(value, "getJavaException", "");
What you're getting back for "value" is not an instance of a type
which has a method called "getJavaException". Instead, it's an
instance of some Python type called "ThrowableType". So (unless
"ThrowableType" inherits from some class which has a
"getJavaException" method), "je" will be NULL, and the error will be
"AttributeError". I see that in the SVN, you've changed
throwPythonError() to avoid passing the AttributeError back to the
caller, and the change in the other part of the wrapper generator
means my subclass isn't raising a Java error any more, anyway, so I
can't demonstrate the bug without writing some Java code (which I'm
avoiding :-).
Bill
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev