Commit 33ca0bc5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix FixupLenReturn

parent 2d565c4c
...@@ -3454,7 +3454,7 @@ BoxedInt* lenInternal(Box* obj, LenRewriteArgs* rewrite_args) noexcept(S == CAPI ...@@ -3454,7 +3454,7 @@ BoxedInt* lenInternal(Box* obj, LenRewriteArgs* rewrite_args) noexcept(S == CAPI
class FixupLenReturn { class FixupLenReturn {
public: public:
static BoxedInt* call(Box* rtn) { static BoxedInt* call(STOLEN(Box*) rtn) {
// TODO: support returning longs as the length // TODO: support returning longs as the length
if (rtn->cls != int_cls) { if (rtn->cls != int_cls) {
Py_DECREF(rtn); Py_DECREF(rtn);
...@@ -3516,6 +3516,7 @@ BoxedInt* lenInternal(Box* obj, LenRewriteArgs* rewrite_args) noexcept(S == CAPI ...@@ -3516,6 +3516,7 @@ BoxedInt* lenInternal(Box* obj, LenRewriteArgs* rewrite_args) noexcept(S == CAPI
if (S == CXX) { if (S == CXX) {
rewrite_args->out_rtn rewrite_args->out_rtn
= rewrite_args->rewriter->call(true, (void*)FixupLenReturn::call, r_rtn)->setType(RefType::OWNED); = rewrite_args->rewriter->call(true, (void*)FixupLenReturn::call, r_rtn)->setType(RefType::OWNED);
r_rtn->refConsumed();
rewrite_args->out_success = true; rewrite_args->out_success = true;
} else { } else {
// Don't know how to propagate the exception // Don't know how to propagate the exception
......
# expected: reffail
# run_args: -n # run_args: -n
# statcheck: noninit_count('slowpath_runtimecall') < 20 # statcheck: noninit_count('slowpath_runtimecall') < 20
......
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