[Python-checkins] Py_IS_TYPE() macro uses Py_TYPE() (GH-22341)

Victor Stinner webhook-mailer at python.org
Tue Sep 22 06:42:33 EDT 2020


https://github.com/python/cpython/commit/c5cb077ab3c88394b7ac8ed4e746bd31b53e39f1
commit: c5cb077ab3c88394b7ac8ed4e746bd31b53e39f1
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-09-22T12:42:28+02:00
summary:

Py_IS_TYPE() macro uses Py_TYPE() (GH-22341)

files:
M Include/object.h

diff --git a/Include/object.h b/Include/object.h
index 10f1d6a3dff2d..6ee4ee7848551 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -141,7 +141,7 @@ static inline PyTypeObject* _Py_TYPE(const PyObject *ob) {
 
 
 static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type) {
-    return ob->ob_type == type;
+    return Py_TYPE(ob) == type;
 }
 #define Py_IS_TYPE(ob, type) _Py_IS_TYPE(_PyObject_CAST_CONST(ob), type)
 



More information about the Python-checkins mailing list