[Python-checkins] CVS: python/dist/src/Objects object.c,2.80,2.81

M.-A. Lemburg python-dev@python.org
Mon, 3 Jul 2000 02:57:55 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25267/Objects

Modified Files:
	object.c 
Log Message:
If auto-conversion fails, the Unicode codecs will return NULL.
This is now checked and the error passed on to the caller.

Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.80
retrieving revision 2.81
diff -C2 -r2.80 -r2.81
*** object.c	2000/07/01 14:31:09	2.80
--- object.c	2000/07/03 09:57:53	2.81
***************
*** 269,276 ****
  			PyObject* str;
  			str = PyUnicode_AsEncodedString(res, NULL, NULL);
! 			if (str) {
! 				Py_DECREF(res);
  				res = str;
! 			}
  		}
  		if (!PyString_Check(res)) {
--- 269,277 ----
  			PyObject* str;
  			str = PyUnicode_AsEncodedString(res, NULL, NULL);
! 			Py_DECREF(res);
! 			if (str)
  				res = str;
! 			else
! 				return NULL;
  		}
  		if (!PyString_Check(res)) {
***************
*** 311,322 ****
  	if (res == NULL)
  		return NULL;
!     if (PyUnicode_Check(res)) {
!         PyObject* str;
!         str = PyUnicode_AsEncodedString(res, NULL, NULL);
!         if (str) {
!             Py_DECREF(res);
!             res = str;
!         }
!     }
  	if (!PyString_Check(res)) {
  		PyErr_Format(PyExc_TypeError,
--- 312,324 ----
  	if (res == NULL)
  		return NULL;
! 	if (PyUnicode_Check(res)) {
! 		PyObject* str;
! 		str = PyUnicode_AsEncodedString(res, NULL, NULL);
! 		Py_DECREF(res);
! 		if (str)
! 			res = str;
! 		else
! 		    	return NULL;
! 	}
  	if (!PyString_Check(res)) {
  		PyErr_Format(PyExc_TypeError,