[Python-checkins] CVS: python/dist/src/Objects abstract.c,2.75,2.76

Tim Peters tim_one@users.sourceforge.net
Mon, 10 Sep 2001 14:28:23 -0700


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

Modified Files:
	abstract.c 
Log Message:
More for SF bug [#460020] bug or feature: unicode() and subclasses
Repair float constructor to return a true float when passed a subclass
instance.  New PyFloat_CheckExact macro.


Index: abstract.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
retrieving revision 2.75
retrieving revision 2.76
diff -C2 -d -r2.75 -r2.76
*** abstract.c	2001/09/10 20:52:51	2.75
--- abstract.c	2001/09/10 21:28:20	2.76
***************
*** 910,916 ****
  	if (o == NULL)
  		return null_error();
! 	if (PyFloat_Check(o)) {
  		Py_INCREF(o);
  		return o;
  	}
  	if (!PyString_Check(o)) {
--- 910,920 ----
  	if (o == NULL)
  		return null_error();
! 	if (PyFloat_CheckExact(o)) {
  		Py_INCREF(o);
  		return o;
+ 	}
+ 	if (PyFloat_Check(o)) {
+ 		PyFloatObject *po = (PyFloatObject *)o;
+ 		return PyFloat_FromDouble(po->ob_fval);
  	}
  	if (!PyString_Check(o)) {