diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-10 20:52:51 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-10 20:52:51 +0000 |
commit | 9061e124d0cc0affa1d0e3b76f4cb4d5c3b77fc1 (patch) | |
tree | 63b5c897c74904c76b01fc2ed4c91bc5c16a53b0 /Include/longobject.h | |
parent | 33a5ef62f640933c882fb0ff7aa56ab256e1556d (diff) | |
download | cpython-9061e124d0cc0affa1d0e3b76f4cb4d5c3b77fc1.tar.gz |
SF bug #460020: bug or feature: unicode() and subclasses.
Given an immutable type M, and an instance I of a subclass of M, the
constructor call M(I) was just returning I as-is; but it should return a
new instance of M. This fixes it for M in {int, long}. Strings, floats
and tuples remain to be done.
Added new macros PyInt_CheckExact and PyLong_CheckExact, to more easily
distinguish between "is" and "is a" (i.e., only an int passes
PyInt_CheckExact, while any sublass of int passes PyInt_Check).
Added private API function _PyLong_Copy.
Diffstat (limited to 'Include/longobject.h')
-rw-r--r-- | Include/longobject.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/longobject.h b/Include/longobject.h index e592891687..6b1062576e 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -12,6 +12,7 @@ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ extern DL_IMPORT(PyTypeObject) PyLong_Type; #define PyLong_Check(op) PyObject_TypeCheck(op, &PyLong_Type) +#define PyLong_CheckExact(op) ((op)->ob_type == &PyLong_Type) extern DL_IMPORT(PyObject *) PyLong_FromLong(long); extern DL_IMPORT(PyObject *) PyLong_FromUnsignedLong(unsigned long); |