From 6ae61959ec51a6b3dddc8e665ce6a7b8aeb26c04 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sat, 5 Sep 2020 17:07:54 +0100 Subject: [PATCH] bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning (GH-22102) --- Objects/exceptions.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c index 966983810cd..8bcf76ff860 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2295,8 +2295,9 @@ MemoryError_dealloc(PyBaseExceptionObject *self) { BaseException_clear(self); - if (Py_TYPE(self) != PyExc_MemoryError) { - return Py_TYPE(self)->tp_free((PyObject *)self); + if (Py_TYPE(self) != (PyTypeObject *)PyExc_MemoryError) { + Py_TYPE(self)->tp_free((PyObject *)self); + return; } _PyObject_GC_UNTRACK(self);