Commit 07158a65 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Reenable this rewriting case

We can rewrite a callattr where the getattr was done via a getattro,
if we are in CXX mode.  This got lost in the "enforce return conventions"
PR and resulted in a 4% slowdown on pyxl bench.
parent 67973cf6
......@@ -2931,7 +2931,6 @@ Box* callattrInternal(Box* obj, BoxedString* attr, LookupScope scope, CallattrRe
GetattrRewriteArgs grewrite_args(rewrite_args->rewriter, rewrite_args->obj, Location::any());
val = getattrInternalEx<S, REWRITABLE>(obj, attr, &grewrite_args, scope == CLASS_ONLY, true, &bind_obj,
&r_bind_obj);
// TODO: maybe callattrs should have return conventions as well.
if (!grewrite_args.isSuccessful())
rewrite_args = NULL;
......@@ -2939,6 +2938,12 @@ Box* callattrInternal(Box* obj, BoxedString* attr, LookupScope scope, CallattrRe
RewriterVar* rtn;
ReturnConvention return_convention;
std::tie(rtn, return_convention) = grewrite_args.getReturn();
if (S == CXX && return_convention == ReturnConvention::CAPI_RETURN) {
rewrite_args->rewriter->checkAndThrowCAPIException(rtn);
return_convention = ReturnConvention::HAS_RETURN;
}
if (return_convention != ReturnConvention::HAS_RETURN && return_convention != ReturnConvention::NO_RETURN)
rewrite_args = NULL;
else
......
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