[Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.52,2.52.2.1

Fred L. Drake fdrake@users.sourceforge.net
Thu, 13 Dec 2001 12:51:26 -0800


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

Modified Files:
      Tag: r22rc1-branch
	complexobject.c 
Log Message:
Integrate (the rest of) the complex() patches into the release candidate;
the documentation patch was included in the original tagging.


Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.52
retrieving revision 2.52.2.1
diff -C2 -d -r2.52 -r2.52.2.1
*** complexobject.c	2001/11/28 20:50:56	2.52
--- complexobject.c	2001/12/13 20:51:24	2.52.2.1
***************
*** 807,812 ****
  					 &r, &i))
  		return NULL;
! 	if (PyString_Check(r) || PyUnicode_Check(r))
  		return complex_subtype_from_string(type, r);
  
  	nbr = r->ob_type->tp_as_number;
--- 807,824 ----
  					 &r, &i))
  		return NULL;
! 	if (PyString_Check(r) || PyUnicode_Check(r)) {
! 		if (i != NULL) {
! 			PyErr_SetString(PyExc_TypeError,
! 					"complex() can't take second arg"
! 					" if first is a string");
! 			return NULL;
!                 }
  		return complex_subtype_from_string(type, r);
+ 	}
+ 	if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) {
+ 		PyErr_SetString(PyExc_TypeError,
+ 				"complex() second arg can't be a string");
+ 		return NULL;
+ 	}
  
  	nbr = r->ob_type->tp_as_number;