From a51edf224e21a2a5749ba08321c276962f3ebc2c Mon Sep 17 00:00:00 2001 From: Sergey Muraviov Date: Wed, 23 Apr 2025 15:01:45 +0300 Subject: [PATCH] Fix using a null pointer in mro_hierarchy (gh-132835) --- Objects/typeobject.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index a720a98121dc93..0924df4def45b6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1652,6 +1652,9 @@ mro_hierarchy(PyTypeObject *type, PyObject *temp) return res; } PyObject *new_mro = lookup_tp_mro(type); + if (new_mro == NULL) { + return -1; + } PyObject *tuple; if (old_mro != NULL) {