[Python-checkins] python/dist/src/Python ceval.c,2.343,2.344

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Fri, 10 Jan 2003 07:31:20 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv4635/Python

Modified Files:
	ceval.c 
Log Message:
As discussed briefly on python-dev, add Pending Deprecation Warning
when a string exception is raised.  Note that raising string exceptions
is deprecated in an exception message.


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.343
retrieving revision 2.344
diff -C2 -d -r2.343 -r2.344
*** ceval.c	9 Jan 2003 15:24:30 -0000	2.343
--- ceval.c	10 Jan 2003 15:31:15 -0000	2.344
***************
*** 2734,2738 ****
  		 * do nothing.  Raising an instance of a new-style str
  		 * subclass is right out. */
! 		;
  
  	else if (PyClass_Check(type))
--- 2734,2739 ----
  		 * do nothing.  Raising an instance of a new-style str
  		 * subclass is right out. */
! 		PyErr_Warn(PyExc_PendingDeprecationWarning,
! 			   "raising a string exception is deprecated");
  
  	else if (PyClass_Check(type))
***************
*** 2758,2763 ****
  		   anyway, just not what you specified :-) */
  		PyErr_Format(PyExc_TypeError,
! 			     "exceptions must be strings, classes, or "
! 			     "instances, not %s", type->ob_type->tp_name);
  		goto raise_error;
  	}
--- 2759,2765 ----
  		   anyway, just not what you specified :-) */
  		PyErr_Format(PyExc_TypeError,
! 			     "exceptions must be classes, instances, or "
! 			     "strings (deprecated), not %s",
! 			     type->ob_type->tp_name);
  		goto raise_error;
  	}