mirror of
https://github.com/python/cpython.git
synced 2024-11-23 09:54:58 +08:00
Make the PyXXX_Check() macros for the numeric types inheritance-aware.
This commit is contained in:
parent
c51395d797
commit
c16fcdf533
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user