[Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.3,2.79.2.4

Guido van Rossum gvanrossum@users.sourceforge.net
2001年5月04日 09:44:55 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv27155
Modified Files:
 Tag: descr-branch
	object.h 
Log Message:
Add dummy versions of PyType_IS_GC(), PyObject_IS_GC(),
PyObject_AS_GC(), PyObject_FROM_GC(), so that idiomatic code using
these doesn't have to be inside #ifdef WITH_CYCLE_GC.
Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.79.2.3
retrieving revision 2.79.2.4
diff -C2 -r2.79.2.3 -r2.79.2.4
*** object.h	2001年04月29日 14:53:55	2.79.2.3
--- object.h	2001年05月04日 16:44:53	2.79.2.4
***************
*** 266,270 ****
--- 266,272 ----
 	descrgetfunc tp_descr_get;
 	descrsetfunc tp_descr_set;
+ 	unaryfunc tp_construct;
 
+ 
 #ifdef COUNT_ALLOCS
 	/* these must be last and never explicitly initialized */
***************
*** 276,282 ****
 } PyTypeObject;
 
 extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */
 
! #define PyType_Check(op) ((op)->ob_type == &PyType_Type)
 
 extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);
--- 278,290 ----
 } PyTypeObject;
 
+ 
+ /* Generic type check */
+ extern DL_IMPORT(int) _PyObject_TypeCheck(PyObject *, PyTypeObject *);
+ #define PyObject_TypeCheck(ob, tp) \
+ 	((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp))
+ 
 extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */
 
! #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type)
 
 extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *);

AltStyle によって変換されたページ (->オリジナル) /