Commit 67635043 authored by Marius Wachtler's avatar Marius Wachtler

rewrite one more GetattrHook path

parent a8f26653
...@@ -1012,24 +1012,26 @@ Box* slotTpGetattrHookInternal(Box* self, BoxedString* name, GetattrRewriteArgs* ...@@ -1012,24 +1012,26 @@ Box* slotTpGetattrHookInternal(Box* self, BoxedString* name, GetattrRewriteArgs*
return res; return res;
} else if (return_convention == ReturnConvention::NO_RETURN) { } else if (return_convention == ReturnConvention::NO_RETURN) {
assert(!res); assert(!res);
} else if (return_convention == ReturnConvention::CAPI_RETURN) { } else if (return_convention == ReturnConvention::CAPI_RETURN
|| return_convention == ReturnConvention::NOEXC_POSSIBLE) {
// If we get a CAPI return, we probably did a function call, and these guards // If we get a CAPI return, we probably did a function call, and these guards
// will probably just make the rewrite fail: // will probably just make the rewrite fail:
if (res) { if (res) {
rtn->addGuardNotEq(0); rtn->addGuardNotEq(0);
rewrite_args->setReturn(rtn, ReturnConvention::HAS_RETURN); rewrite_args->setReturn(rtn, ReturnConvention::HAS_RETURN);
return res; return res;
} else } else {
rtn->addGuard(0); // this could set a CAPI exception and we won't clear it inside the rewrite.
rewrite_args = 0;
}
} else { } else {
assert(return_convention == ReturnConvention::NOEXC_POSSIBLE); RELEASE_ASSERT(0, "");
rewrite_args = NULL;
} }
} }
} else { } else {
try { try {
assert(!PyType_Check(self)); // There would be a getattribute assert(!PyType_Check(self)); // There would be a getattribute
res = getattrInternalGeneric<false, rewritable>(self, name, NULL, false, false, NULL, NULL); res = getattrInternalGeneric<false, NOT_REWRITABLE>(self, name, NULL, false, false, NULL, NULL);
} catch (ExcInfo e) { } catch (ExcInfo e) {
if (!e.matches(AttributeError)) { if (!e.matches(AttributeError)) {
if (S == CAPI) { if (S == CAPI) {
......
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