summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-08-29 15:45:32 (GMT)
committerGuido van Rossum <guido@python.org>2001-08-29 15:45:32 (GMT)
commitc16fcdf533583039d687f8ca2e88a1c21f3feeb3 (patch)
tree987f9612707f568bcc20164da3993670073cfc6f /Include
parentc51395d79744a1aeb456d34b9bf5b5ea110ee677 (diff)
downloadcpython-c16fcdf533583039d687f8ca2e88a1c21f3feeb3.zip
cpython-c16fcdf533583039d687f8ca2e88a1c21f3feeb3.tar.gz
cpython-c16fcdf533583039d687f8ca2e88a1c21f3feeb3.tar.bz2
Make the PyXXX_Check() macros for the numeric types inheritance-aware.
Diffstat (limited to 'Include')
-rw-r--r--Include/complexobject.h2
-rw-r--r--Include/floatobject.h2
-rw-r--r--Include/intobject.h2
-rw-r--r--Include/longobject.h2
4 files changed, 4 insertions, 4 deletions
diff --git a/Include/complexobject.h b/Include/complexobject.h
index ef5016f..edd2069 100644
--- a/Include/complexobject.h
+++ b/Include/complexobject.h
@@ -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);
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 6e36a2f..9f67bc1 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -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
diff --git a/Include/intobject.h b/Include/intobject.h
index 128d0d3..29448e3 100644
--- a/Include/intobject.h
+++ b/Include/intobject.h
@@ -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
diff --git a/Include/longobject.h b/Include/longobject.h
index 8efa35f..5d1ea0a 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -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);