]> granicus.if.org Git - python/commitdiff
Make the PyXXX_Check() macros for the numeric types inheritance-aware.
authorGuido van Rossum <guido@python.org>
Wed, 29 Aug 2001 15:45:32 +0000 (15:45 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 29 Aug 2001 15:45:32 +0000 (15:45 +0000)
Include/complexobject.h
Include/floatobject.h
Include/intobject.h
Include/longobject.h

index ef5016fe41a6de2288421654b547ed34257c334c..edd20698f2de7b60333b3d8d297c69f373ea10f3 100644 (file)
@@ -42,7 +42,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyComplex_Type;
 
-#define PyComplex_Check(op) ((op)->ob_type == &PyComplex_Type)
+#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
 
 extern DL_IMPORT(PyObject *) PyComplex_FromCComplex(Py_complex);
 extern DL_IMPORT(PyObject *) PyComplex_FromDoubles(double real, double imag);
index 6e36a2f318715581508d5a4027fe7e1ee9bc8412..9f67bc107d63ee3a83ce8b867933dbdceee6d566 100644 (file)
@@ -18,7 +18,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyFloat_Type;
 
-#define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type)
+#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
 
 /* Return Python float from string PyObject.  Second argument ignored on
    input, and, if non-NULL, NULL is stored into *junk (this tried to serve a
index 128d0d31cdb1604b96ea8f709c50e18ee3e40208..29448e3cc17da027c895212cc93df318c151a024 100644 (file)
@@ -27,7 +27,7 @@ typedef struct {
 
 extern DL_IMPORT(PyTypeObject) PyInt_Type;
 
-#define PyInt_Check(op) ((op)->ob_type == &PyInt_Type)
+#define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type)
 
 extern DL_IMPORT(PyObject *) PyInt_FromString(char*, char**, int);
 #ifdef Py_USING_UNICODE
index 8efa35faa5f7ad1d52b9dd0ae0101db1bd1fcf8f..5d1ea0a51742c8660d951239a75b1c5dd538d729 100644 (file)
@@ -11,7 +11,7 @@ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
 
 extern DL_IMPORT(PyTypeObject) PyLong_Type;
 
-#define PyLong_Check(op) ((op)->ob_type == &PyLong_Type)
+#define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type)
 
 extern DL_IMPORT(PyObject *) PyLong_FromLong(long);
 extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long);