Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions Objects/typeobject.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -647,7 +647,6 @@ clear_tp_bases(PyTypeObject *self, int final)
static inline PyObject *
lookup_tp_mro(PyTypeObject *self)
{
ASSERT_NEW_TYPE_OR_LOCKED(self);
return self->tp_mro;
}

Expand All@@ -664,8 +663,19 @@ set_tp_mro(PyTypeObject *self, PyObject *mro, int initial)
/* Other checks are done via set_tp_bases. */
_Py_SetImmortal(mro);
}
else {
PyUnstable_Object_EnableDeferredRefcount(mro);
}
}
if (!initial) {
type_lock_prevent_release();
types_stop_world();
}
self->tp_mro = mro;
if (!initial) {
types_start_world();
type_lock_allow_release();
}
}

static inline void
Expand DownExpand Up@@ -1728,18 +1738,11 @@ static PyObject *
type_get_mro(PyObject *tp, void *Py_UNUSED(closure))
{
PyTypeObject *type = PyTypeObject_CAST(tp);
PyObject *mro;

BEGIN_TYPE_LOCK();
mro = lookup_tp_mro(type);
PyObject *mro = lookup_tp_mro(type);
if (mro == NULL) {
mro = Py_None;
} else {
Py_INCREF(mro);
Py_RETURN_NONE;
}

END_TYPE_LOCK();
return mro;
return Py_NewRef(mro);
}

static PyTypeObject *find_best_base(PyObject *);
Expand Down
Loading