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

Tim Peters tim_one@users.sourceforge.net
Sat, 27 Oct 2001 12:37:50 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv12753/python/Include

Modified Files:
	object.h 
Log Message:
SF bug #475327:  type() produces incorrect error msg

object.h:  Added PyType_CheckExact macro.

typeobject.c, type_new():

+ Use the new macro.
+ Assert that the arguments have the right types rather than do incomplete
  runtime checks "sometimes".
+ If this isn't the 1-argument flavor() of type, and there aren't 3 args
  total, produce a "types() takes 1 or 3 args" msg before
  PyArg_ParseTupleAndKeywords produces a "takes exactly 3" msg.


Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.97
retrieving revision 2.98
diff -C2 -d -r2.97 -r2.98
*** object.h	2001/10/15 22:03:31	2.97
--- object.h	2001/10/27 19:37:47	2.98
***************
*** 313,316 ****
--- 313,317 ----
  
  #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type)
+ #define PyType_CheckExact(op) ((op)->ob_type == &PyType_Type)
  
  extern DL_IMPORT(int) PyType_Ready(PyTypeObject *);