Skip to content

Commit 00cd065

Browse files
committed
Reduce diff
1 parent 12b961b commit 00cd065

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

Include/internal/pycore_stackref.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ PyStackRef_MakeHeapSafe(_PyStackRef ref)
179179
PyStackRef_XCLOSE(_tmp_old_op); \
180180
} while (0)
181181

182-
183182
static inline _PyStackRef
184183
_PyStackRef_FromPyObjectStealMortal(PyObject *obj, const char *filename, int linenumber)
185184
{
@@ -562,6 +561,14 @@ PyStackRef_XCLOSE(_PyStackRef ref)
562561
}
563562
}
564563

564+
#define PyStackRef_CLEAR(REF) \
565+
do { \
566+
_PyStackRef *_tmp_op_ptr = &(REF); \
567+
_PyStackRef _tmp_old_op = (*_tmp_op_ptr); \
568+
*_tmp_op_ptr = PyStackRef_NULL; \
569+
PyStackRef_XCLOSE(_tmp_old_op); \
570+
} while (0)
571+
565572

566573
#endif // Py_GIL_DISABLED
567574

Python/bytecodes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@ dummy_func(
916916
STAT_INC(BINARY_OP, hit);
917917
PyObject *res_o = PyTuple_GET_ITEM(tuple, index);
918918
assert(res_o != NULL);
919+
PyStackRef_CLOSE_SPECIALIZED(sub_st, _PyLong_ExactDealloc);
919920
res = PyStackRef_FromPyObjectNew(res_o);
920921
DECREF_INPUTS();
921922
}

Python/executor_cases.c.h

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_cases.c.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)