From 8a7eb8b2ab2d9bf20f2fdc77177f735331fa9a72 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Wed, 4 Mar 2026 13:32:43 -0500 Subject: [PATCH] gh-145500: Delete _PyType_GetMRO (gh-145501) --- Include/internal/pycore_typeobject.h | 1 - Objects/typeobject.c | 22 ---------------------- 2 files changed, 23 deletions(-) diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index 8af317d54c0b..9c8b00550e39 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -96,7 +96,6 @@ PyAPI_FUNC(PyObject *) _PyType_LookupSubclasses(PyTypeObject *); PyAPI_FUNC(PyObject *) _PyType_InitSubclasses(PyTypeObject *); extern PyObject * _PyType_GetBases(PyTypeObject *type); -extern PyObject * _PyType_GetMRO(PyTypeObject *type); extern PyObject* _PyType_GetSubclasses(PyTypeObject *); extern int _PyType_HasSubclasses(PyTypeObject *); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index d77d981085f4..c5e94a8668fe 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -651,28 +651,6 @@ lookup_tp_mro(PyTypeObject *self) return self->tp_mro; } -PyObject * -_PyType_GetMRO(PyTypeObject *self) -{ -#ifdef Py_GIL_DISABLED - PyObject *mro = _Py_atomic_load_ptr_relaxed(&self->tp_mro); - if (mro == NULL) { - return NULL; - } - if (_Py_TryIncrefCompare(&self->tp_mro, mro)) { - return mro; - } - - BEGIN_TYPE_LOCK(); - mro = lookup_tp_mro(self); - Py_XINCREF(mro); - END_TYPE_LOCK(); - return mro; -#else - return Py_XNewRef(lookup_tp_mro(self)); -#endif -} - static inline void set_tp_mro(PyTypeObject *self, PyObject *mro, int initial) { -- 2.47.3