https://github.com/python/cpython/commit/14cbd0e6afa98355bdc6749b8230fed4c9b21bd6
commit: 14cbd0e6afa98355bdc6749b8230fed4c9b21bd6
branch: main
author: Chris Eibl <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2026-02-14T14:09:01Z
summary:

remove unused _PyFunction_LookupByVersion (GH-144814)

files:
M Include/internal/pycore_function.h
M Objects/funcobject.c
M Python/optimizer.c

diff --git a/Include/internal/pycore_function.h 
b/Include/internal/pycore_function.h
index 522e03c6696993..9c2121f59a4a0c 100644
--- a/Include/internal/pycore_function.h
+++ b/Include/internal/pycore_function.h
@@ -30,7 +30,6 @@ _PyFunction_IsVersionValid(uint32_t version)
 extern uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func);
 PyAPI_FUNC(void) _PyFunction_SetVersion(PyFunctionObject *func, uint32_t 
version);
 void _PyFunction_ClearCodeByVersion(uint32_t version);
-PyFunctionObject *_PyFunction_LookupByVersion(uint32_t version, PyObject 
**p_code);
 
 extern PyObject *_Py_set_function_type_params(
     PyThreadState* unused, PyObject *func, PyObject *type_params);
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 8f4ff4e42392c2..ee0c46a95b9708 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -373,32 +373,6 @@ _PyFunction_ClearCodeByVersion(uint32_t version)
 #endif
 }
 
-PyFunctionObject *
-_PyFunction_LookupByVersion(uint32_t version, PyObject **p_code)
-{
-#ifdef Py_GIL_DISABLED
-    return NULL;
-#else
-    PyInterpreterState *interp = _PyInterpreterState_GET();
-    struct _func_version_cache_item *slot = get_cache_item(interp, version);
-    if (slot->code) {
-        assert(PyCode_Check(slot->code));
-        PyCodeObject *code = (PyCodeObject *)slot->code;
-        if (code->co_version == version) {
-            *p_code = slot->code;
-        }
-    }
-    else {
-        *p_code = NULL;
-    }
-    if (slot->func && slot->func->func_version == version) {
-        assert(slot->func->func_code == slot->code);
-        return slot->func;
-    }
-    return NULL;
-#endif
-}
-
 uint32_t
 _PyFunction_GetVersionForCurrentState(PyFunctionObject *func)
 {
diff --git a/Python/optimizer.c b/Python/optimizer.c
index bf5d8a28264635..12ef7c3fc0adf5 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -8,7 +8,6 @@
 #include "pycore_bitutils.h"        // _Py_popcount32()
 #include "pycore_ceval.h"       // _Py_set_eval_breaker_bit
 #include "pycore_code.h"            // _Py_GetBaseCodeUnit
-#include "pycore_function.h"        // _PyFunction_LookupByVersion()
 #include "pycore_interpframe.h"
 #include "pycore_object.h"          // _PyObject_GC_UNTRACK()
 #include "pycore_opcode_metadata.h" // _PyOpcode_OpName[]

_______________________________________________
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