Skip to content

Commit 19307ba

Browse files
committed
Fix crash due to refcount shenanigans
Also avoid compiler warning for unused variable 'null' (used in assert only).
1 parent f2bad0d commit 19307ba

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Python/bytecodes.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -2949,7 +2949,7 @@ dummy_func(
29492949
CHECK_EVAL_BREAKER();
29502950
}
29512951

2952-
inst(CALL_FUNCTION_EX, (null, func, callargs, kwargs if (oparg & 1) -- result)) {
2952+
inst(CALL_FUNCTION_EX, (unused, func, callargs, kwargs if (oparg & 1) -- result)) {
29532953
if (oparg & 1) {
29542954
// DICT_MERGE is called before this opcode if there are kwargs.
29552955
// It converts all dict subtypes in kwargs into regular dicts.
@@ -2959,10 +2959,11 @@ dummy_func(
29592959
if (check_args_iterable(tstate, func, callargs) < 0) {
29602960
goto error;
29612961
}
2962-
Py_SETREF(callargs, PySequence_Tuple(callargs));
2963-
if (callargs == NULL) {
2962+
PyObject *tuple = PySequence_Tuple(callargs);
2963+
if (tuple == NULL) {
29642964
goto error;
29652965
}
2966+
Py_SETREF(callargs, tuple);
29662967
}
29672968
assert(PyTuple_CheckExact(callargs));
29682969

@@ -2971,7 +2972,7 @@ dummy_func(
29712972
Py_DECREF(callargs);
29722973
Py_XDECREF(kwargs);
29732974

2974-
assert(null == NULL);
2975+
assert(PEEK(3 + (oparg & 1)) == NULL);
29752976
ERROR_IF(result == NULL, error);
29762977
CHECK_EVAL_BREAKER();
29772978
}

Python/generated_cases.c.h

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)