Skip to content

Commit 1b715fc

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Get rid of immortal incref's in jit_rt.cpp
Summary: None/True/False are all immortal, we don't need to incref them Reviewed By: alexmalyshev Differential Revision: D109739869 fbshipit-source-id: 03335e4dcd0aa84a767685fed0a63a140533ad71
1 parent 8fc90c2 commit 1b715fc

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

cinderx/Jit/jit_rt.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,8 @@ PyObject* JITRT_VectorcallTstate(
10871087
PyObject* JITRT_UnaryNot(PyObject* value) {
10881088
int res = PyObject_IsTrue(value);
10891089
if (res == 0) {
1090-
Py_INCREF(Py_True);
10911090
return Py_True;
10921091
} else if (res > 0) {
1093-
Py_INCREF(Py_False);
10941092
return Py_False;
10951093
}
10961094
return nullptr;
@@ -1103,7 +1101,6 @@ LoadMethodResult JITRT_GetMethod(PyObject* obj, PyObject* name) {
11031101
return {nullptr, nullptr};
11041102
}
11051103
if (!found) {
1106-
Py_INCREF(Py_None);
11071104
return {Py_None, method};
11081105
}
11091106
Py_INCREF(obj);
@@ -1167,7 +1164,6 @@ LoadMethodResult JITRT_GetMethodFromSuper(
11671164
Py_INCREF(self);
11681165
return {result, self};
11691166
}
1170-
Py_INCREF(Py_None);
11711167
return {Py_None, result};
11721168
}
11731169

0 commit comments

Comments
 (0)