From: Guido van Rossum <guido@python.org>
Date: Thu, 30 Aug 2001 03:08:07 +0000 (+0000)
Subject: Make the Py<type>_Check() macro use PyObject_TypeCheck().
X-Git-Tag: v2.2a3~223
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5eef77a21be8a7895419cc84e8bf5554ca908b54;p=python

Make the Py<type>_Check() macro use PyObject_TypeCheck().
---

diff --git a/Include/stringobject.h b/Include/stringobject.h
index 2d9ed2d91c..a67e33e3a8 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -51,7 +51,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyString_Type;
 
-#define PyString_Check(op) ((op)->ob_type == &PyString_Type)
+#define PyString_Check(op) PyObject_TypeCheck(op, &PyString_Type)
 
 extern DL_IMPORT(PyObject *) PyString_FromStringAndSize(const char *, int);
 extern DL_IMPORT(PyObject *) PyString_FromString(const char *);
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index bf208547d4..3da3fe0a49 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -26,7 +26,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyTuple_Type;
 
-#define PyTuple_Check(op) ((op)->ob_type == &PyTuple_Type)
+#define PyTuple_Check(op) PyObject_TypeCheck(op, &PyTuple_Type)
 
 extern DL_IMPORT(PyObject *) PyTuple_New(int size);
 extern DL_IMPORT(int) PyTuple_Size(PyObject *);
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 025c8b7654..dbeb883eb3 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -372,7 +372,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyUnicode_Type;
 
-#define PyUnicode_Check(op) (((op)->ob_type == &PyUnicode_Type))
+#define PyUnicode_Check(op) PyObject_TypeCheck(op, &PyUnicode_Type)
 
 /* Fast access macros */
 #define PyUnicode_GET_SIZE(op) \