[Python-checkins] CVS: python/dist/src/Include intobject.h,2.23,2.24 longintrepr.h,2.11,2.12 longobject.h,2.23,2.24
Tim Peters
tim_one@users.sourceforge.net
Mon, 10 Sep 2001 13:53:19 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv24621/python/Include
Modified Files:
intobject.h longintrepr.h longobject.h
Log Message:
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.
Index: intobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/intobject.h,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** intobject.h 2001/08/29 15:45:32 2.23
--- intobject.h 2001/09/10 20:52:47 2.24
***************
*** 29,32 ****
--- 29,33 ----
#define PyInt_Check(op) PyObject_TypeCheck(op, &PyInt_Type)
+ #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type)
extern DL_IMPORT(PyObject *) PyInt_FromString(char*, char**, int);
Index: longintrepr.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/longintrepr.h,v
retrieving revision 2.11
retrieving revision 2.12
diff -C2 -d -r2.11 -r2.12
*** longintrepr.h 2000/09/01 23:29:26 2.11
--- longintrepr.h 2001/09/10 20:52:47 2.12
***************
*** 47,50 ****
--- 47,53 ----
DL_IMPORT(PyLongObject *) _PyLong_New(int);
+ /* Return a copy of src. */
+ DL_IMPORT(PyObject *) _PyLong_Copy(PyLongObject *src);
+
#ifdef __cplusplus
}
Index: longobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/longobject.h,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** longobject.h 2001/09/04 02:50:49 2.23
--- longobject.h 2001/09/10 20:52:47 2.24
***************
*** 13,16 ****
--- 13,17 ----
#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);