Skip to content

Commit 9e69bca

Browse files
committed
pythongh-127022: Remove _PyEvalFramePushAndInit_UnTagged
The interpreter now handles `_PyStackRef`s pointing to immortal objects without the deferred bit set, so `_PyEvalFramePushAndInit_UnTagged` is no longer necessary.
1 parent 4759ba6 commit 9e69bca

File tree

1 file changed

+4
-31
lines changed

1 file changed

+4
-31
lines changed

Python/ceval.c

+4-31
Original file line numberDiff line numberDiff line change
@@ -1800,33 +1800,6 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
18001800
return NULL;
18011801
}
18021802

1803-
static _PyInterpreterFrame *
1804-
_PyEvalFramePushAndInit_UnTagged(PyThreadState *tstate, _PyStackRef func,
1805-
PyObject *locals, PyObject *const* args,
1806-
size_t argcount, PyObject *kwnames, _PyInterpreterFrame *previous)
1807-
{
1808-
#if defined(Py_GIL_DISABLED)
1809-
size_t kw_count = kwnames == NULL ? 0 : PyTuple_GET_SIZE(kwnames);
1810-
size_t total_argcount = argcount + kw_count;
1811-
_PyStackRef *tagged_args_buffer = PyMem_Malloc(sizeof(_PyStackRef) * total_argcount);
1812-
if (tagged_args_buffer == NULL) {
1813-
PyErr_NoMemory();
1814-
return NULL;
1815-
}
1816-
for (size_t i = 0; i < argcount; i++) {
1817-
tagged_args_buffer[i] = PyStackRef_FromPyObjectSteal(args[i]);
1818-
}
1819-
for (size_t i = 0; i < kw_count; i++) {
1820-
tagged_args_buffer[argcount + i] = PyStackRef_FromPyObjectSteal(args[argcount + i]);
1821-
}
1822-
_PyInterpreterFrame *res = _PyEvalFramePushAndInit(tstate, func, locals, (_PyStackRef const *)tagged_args_buffer, argcount, kwnames, previous);
1823-
PyMem_Free(tagged_args_buffer);
1824-
return res;
1825-
#else
1826-
return _PyEvalFramePushAndInit(tstate, func, locals, (_PyStackRef const *)args, argcount, kwnames, previous);
1827-
#endif
1828-
}
1829-
18301803
/* Same as _PyEvalFramePushAndInit but takes an args tuple and kwargs dict.
18311804
Steals references to func, callargs and kwargs.
18321805
*/
@@ -1851,9 +1824,9 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func,
18511824
Py_INCREF(PyTuple_GET_ITEM(callargs, i));
18521825
}
18531826
}
1854-
_PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit_UnTagged(
1827+
_PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit(
18551828
tstate, func, locals,
1856-
newargs, nargs, kwnames, previous
1829+
(_PyStackRef const *)newargs, nargs, kwnames, previous
18571830
);
18581831
if (has_dict) {
18591832
_PyStack_UnpackDict_FreeNoDecRef(newargs, kwnames);
@@ -1888,9 +1861,9 @@ _PyEval_Vector(PyThreadState *tstate, PyFunctionObject *func,
18881861
Py_INCREF(args[i+argcount]);
18891862
}
18901863
}
1891-
_PyInterpreterFrame *frame = _PyEvalFramePushAndInit_UnTagged(
1864+
_PyInterpreterFrame *frame = _PyEvalFramePushAndInit(
18921865
tstate, PyStackRef_FromPyObjectNew(func), locals,
1893-
args, argcount, kwnames, NULL);
1866+
(_PyStackRef const *)args, argcount, kwnames, NULL);
18941867
if (frame == NULL) {
18951868
return NULL;
18961869
}

0 commit comments

Comments
 (0)