[Python-checkins] bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning (GH-22102)

Pablo Galindo webhook-mailer at python.org
Sat Sep 5 12:08:02 EDT 2020


https://github.com/python/cpython/commit/6ae61959ec51a6b3dddc8e665ce6a7b8aeb26c04
commit: 6ae61959ec51a6b3dddc8e665ce6a7b8aeb26c04
branch: 3.8
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-09-05T17:07:54+01:00
summary:

bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning (GH-22102)

files:
M Objects/exceptions.c

diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 966983810cd1e..8bcf76ff860a2 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);



More information about the Python-checkins mailing list