[Python-checkins] CVS: python/dist/src/Objects descrobject.c,2.1,2.2 typeobject.c,2.33,2.34

Guido van Rossum gvanrossum@users.sourceforge.net
Thu, 16 Aug 2001 01:27:35 -0700


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

Modified Files:
	descrobject.c typeobject.c 
Log Message:
Subtle change to make None.__class__ work:

- descrobject.c:descr_check(): only believe None means the same as
  NULL if the type given is None's type.

- typeobject.c:wrap_descr_get(): don't "conventiently" default an
  absent type to the type of the object argument.  Let the called
  function figure it out.



Index: descrobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v
retrieving revision 2.1
retrieving revision 2.2
diff -C2 -d -r2.1 -r2.2
*** descrobject.c	2001/08/02 04:15:00	2.1
--- descrobject.c	2001/08/16 08:27:33	2.2
***************
*** 92,98 ****
  static int
  descr_check(PyDescrObject *descr, PyObject *obj, PyTypeObject *type,
! 	  PyObject **pres)
  {
! 	if (obj == NULL || obj == Py_None) {
  		Py_INCREF(descr);
  		*pres = (PyObject *)descr;
--- 92,98 ----
  static int
  descr_check(PyDescrObject *descr, PyObject *obj, PyTypeObject *type,
! 	    PyObject **pres)
  {
! 	if (obj == NULL || (obj == Py_None && type != Py_None->ob_type)) {
  		Py_INCREF(descr);
  		*pres = (PyObject *)descr;

Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.33
retrieving revision 2.34
diff -C2 -d -r2.33 -r2.34
*** typeobject.c	2001/08/15 23:57:02	2.33
--- typeobject.c	2001/08/16 08:27:33	2.34
***************
*** 1863,1868 ****
  	if (!PyArg_ParseTuple(args, "O|O", &obj, &type))
  		return NULL;
- 	if (type == NULL)
- 		type = (PyObject *)obj->ob_type;
  	return (*func)(self, obj, type);
  }
--- 1863,1866 ----