Commit 85a9a4b0 authored by Marius Wachtler's avatar Marius Wachtler

BoxedCApiFunction::tppCall: always check return value before calling checkAndThrowCAPIException()

this gets triggered by M2Crypto which sets an error but returns None.
previously we throw the error in the non rewriter path and ignored it in the rewriter.
this makes it now identical and mote like cpython does it (only looks at the return value)
parent 0c6b51f1
...@@ -1872,7 +1872,8 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa ...@@ -1872,7 +1872,8 @@ Box* BoxedCApiFunction::tppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPa
rewrite_args->out_success = true; rewrite_args->out_success = true;
} }
checkAndThrowCAPIException(); if (!rtn)
throwCAPIException();
assert(rtn && "should have set + thrown an exception!"); assert(rtn && "should have set + thrown an exception!");
return rtn; return rtn;
} }
......
...@@ -202,7 +202,8 @@ extern "C" void raise3(STOLEN(Box*) arg0, STOLEN(Box*) arg1, STOLEN(Box*) arg2) ...@@ -202,7 +202,8 @@ extern "C" void raise3(STOLEN(Box*) arg0, STOLEN(Box*) arg1, STOLEN(Box*) arg2)
if (reraise) if (reraise)
startReraise(); startReraise();
assert(!PyErr_Occurred()); if (PyErr_Occurred())
PyErr_Clear();
throw exc_info; throw exc_info;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment