Skip to content

Commit be78699

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Back out "Revert D92315076: [CinderX] Fix JIT descriptor leak"
Summary: This was reverted but it looks like D91839270 is the underlying cause. See successful canaries in the test plan for D93795189. Another Claude find, and it's true. You can see in the error case the ref isn't closed: https://www.internalfb.com/code/fbsource/[9d30d92ea5b14652a06282272846963473638d19]/third-party/python/main/patched/Objects/typeobject.c?lines=2978 Original commit changeset: 13b585cadd56 Original Phabricator Diff: D92315076 Reviewed By: alexmalyshev Differential Revision: D93795189 fbshipit-source-id: 3c1354c1579e7187984a143f69e1cc2431cdac28
1 parent f8f55ba commit be78699

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cinderx/Jit/jit_rt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,10 @@ LoadMethodResult JITRT_LoadSpecial(
21892189
int err = _PyObject_LookupSpecialMethod(name, method_and_self);
21902190
if (err <= 0) {
21912191
PyStackRef_CLOSE(method_and_self[1]);
2192-
if (err == 0) {
2192+
if (err < 0) {
2193+
// When __get__ raises, method_and_self[0] holds a ref to the descriptor
2194+
PyStackRef_XCLOSE(method_and_self[0]);
2195+
} else if (err == 0) {
21932196
PyObject* owner = PyStackRef_AsPyObjectBorrow(method_and_self[1]);
21942197
const char* errfmt = _PyEval_SpecialMethodCanSuggest(owner, special_idx)
21952198
? _Py_SpecialMethods[special_idx].error_suggestion

0 commit comments

Comments
 (0)