https://github.com/python/cpython/commit/d3da04bfc91ec065fe587451409102213af0e57c
commit: d3da04bfc91ec065fe587451409102213af0e57c
branch: main
author: Sam Gross <[email protected]>
committer: colesbury <[email protected]>
date: 2024-11-25T12:24:37-05:00
summary:

gh-127022: Remove `_PyEvalFramePushAndInit_UnTagged` (gh-127168)

The interpreter now handles `_PyStackRef`s pointing to immortal objects
without the deferred bit set, so `_PyEvalFramePushAndInit_UnTagged` is
no longer necessary.

files:
M Python/ceval.c

diff --git a/Python/ceval.c b/Python/ceval.c
index 2a3938572c1569..eba0f233a81ef3 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1800,33 +1800,6 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, 
_PyStackRef func,
     return NULL;
 }
 
-static _PyInterpreterFrame *
-_PyEvalFramePushAndInit_UnTagged(PyThreadState *tstate, _PyStackRef func,
-                        PyObject *locals, PyObject *const* args,
-                        size_t argcount, PyObject *kwnames, 
_PyInterpreterFrame *previous)
-{
-#if defined(Py_GIL_DISABLED)
-    size_t kw_count = kwnames == NULL ? 0 : PyTuple_GET_SIZE(kwnames);
-    size_t total_argcount = argcount + kw_count;
-    _PyStackRef *tagged_args_buffer = PyMem_Malloc(sizeof(_PyStackRef) * 
total_argcount);
-    if (tagged_args_buffer == NULL) {
-        PyErr_NoMemory();
-        return NULL;
-    }
-    for (size_t i = 0; i < argcount; i++) {
-        tagged_args_buffer[i] = PyStackRef_FromPyObjectSteal(args[i]);
-    }
-    for (size_t i = 0; i < kw_count; i++) {
-        tagged_args_buffer[argcount + i] = 
PyStackRef_FromPyObjectSteal(args[argcount + i]);
-    }
-    _PyInterpreterFrame *res = _PyEvalFramePushAndInit(tstate, func, locals, 
(_PyStackRef const *)tagged_args_buffer, argcount, kwnames, previous);
-    PyMem_Free(tagged_args_buffer);
-    return res;
-#else
-    return _PyEvalFramePushAndInit(tstate, func, locals, (_PyStackRef const 
*)args, argcount, kwnames, previous);
-#endif
-}
-
 /* Same as _PyEvalFramePushAndInit but takes an args tuple and kwargs dict.
    Steals references to func, callargs and kwargs.
 */
@@ -1851,9 +1824,9 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, 
_PyStackRef func,
             Py_INCREF(PyTuple_GET_ITEM(callargs, i));
         }
     }
-    _PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit_UnTagged(
+    _PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit(
         tstate, func, locals,
-        newargs, nargs, kwnames, previous
+        (_PyStackRef const *)newargs, nargs, kwnames, previous
     );
     if (has_dict) {
         _PyStack_UnpackDict_FreeNoDecRef(newargs, kwnames);
@@ -1888,9 +1861,9 @@ _PyEval_Vector(PyThreadState *tstate, PyFunctionObject 
*func,
             Py_INCREF(args[i+argcount]);
         }
     }
-    _PyInterpreterFrame *frame = _PyEvalFramePushAndInit_UnTagged(
+    _PyInterpreterFrame *frame = _PyEvalFramePushAndInit(
         tstate, PyStackRef_FromPyObjectNew(func), locals,
-        args, argcount, kwnames, NULL);
+        (_PyStackRef const *)args, argcount, kwnames, NULL);
     if (frame == NULL) {
         return NULL;
     }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to