[Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.14,2.79.2.15
Guido van Rossum
gvanrossum@users.sourceforge.net
Sat, 16 Jun 2001 07:41:42 -0700
Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv11001/Include
Modified Files:
Tag: descr-branch
object.h
Log Message:
I think I've got the right solution for tp_alloc: it's a lower-level
function that really should only allocate the memory and initialize
the type and refcount. The new signature gets the number of items (in
case it's a VarObject). The smarts have to be put in tp_new().
Thies does away wih my fear that tp_alloc() and tp_new() would have to
be merged -- they are both needed.
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.79.2.14
retrieving revision 2.79.2.15
diff -C2 -r2.79.2.14 -r2.79.2.15
*** object.h 2001/06/16 13:59:48 2.79.2.14
--- object.h 2001/06/16 14:41:40 2.79.2.15
***************
*** 206,210 ****
typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
! typedef PyObject *(*allocfunc)(struct _typeobject *, PyObject *, PyObject *);
typedef struct _typeobject {
--- 206,211 ----
typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *);
typedef int (*initproc)(PyObject *, PyObject *, PyObject *);
! typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *);
! typedef PyObject *(*allocfunc)(struct _typeobject *, int);
typedef struct _typeobject {
***************
*** 271,275 ****
initproc tp_init;
allocfunc tp_alloc;
! allocfunc tp_new;
PyObject *tp_bases;
PyObject *tp_mro; /* method resolution order */
--- 272,276 ----
initproc tp_init;
allocfunc tp_alloc;
! newfunc tp_new;
PyObject *tp_bases;
PyObject *tp_mro; /* method resolution order */
***************
*** 297,302 ****
extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);
! extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *,
! PyObject *, PyObject *);
extern DL_IMPORT(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject *, PyObject *);
--- 298,302 ----
extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);
! extern DL_IMPORT(PyObject *) PyType_GenericAlloc(PyTypeObject *, int);
extern DL_IMPORT(PyObject *) PyType_GenericNew(PyTypeObject *,
PyObject *, PyObject *);