[Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.131,2.132

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 23 Mar 2001 09:54:45 -0800


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

Modified Files:
	pythonrun.c 
Log Message:
Finishing touch to Ping's changes.  This is a patch that Ping sent me
but apparently he had to go to school, so I am checking it in for him.

This makes PyRun_HandleSystemExit() a static instead, called
handle_system_exit(), and let it use the current exception rather than
passing in an exception.  This slightly simplifies the code.


Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.131
retrieving revision 2.132
diff -C2 -r2.131 -r2.132
*** pythonrun.c	2001/03/23 17:34:02	2.131
--- pythonrun.c	2001/03/23 17:54:43	2.132
***************
*** 799,805 ****
  }
  
! void
! PyRun_HandleSystemExit(PyObject* value)
  {
  	if (Py_FlushLine())
  		PyErr_Clear();
--- 799,807 ----
  }
  
! static void
! handle_system_exit(void)
  {
+         PyObject *exception, *value, *tb;
+ 	PyErr_Fetch(&exception, &value, &tb);
  	if (Py_FlushLine())
  		PyErr_Clear();
***************
*** 832,844 ****
  {
  	PyObject *exception, *v, *tb, *hook;
  	PyErr_Fetch(&exception, &v, &tb);
  	PyErr_NormalizeException(&exception, &v, &tb);
- 
  	if (exception == NULL)
  		return;
- 
- 	if (PyErr_GivenExceptionMatches(exception, PyExc_SystemExit)) {
- 		PyRun_HandleSystemExit(v);
- 	}
  	if (set_sys_last_vars) {
  		PySys_SetObject("last_type", exception);
--- 834,845 ----
  {
  	PyObject *exception, *v, *tb, *hook;
+ 
+ 	if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
+ 		handle_system_exit();
+ 	}
  	PyErr_Fetch(&exception, &v, &tb);
  	PyErr_NormalizeException(&exception, &v, &tb);
  	if (exception == NULL)
  		return;
  	if (set_sys_last_vars) {
  		PySys_SetObject("last_type", exception);
***************
*** 853,862 ****
  		if (result == NULL) {
  			PyObject *exception2, *v2, *tb2;
  			PyErr_Fetch(&exception2, &v2, &tb2);
  			PyErr_NormalizeException(&exception2, &v2, &tb2);
- 			if (PyErr_GivenExceptionMatches(
- 				exception2, PyExc_SystemExit)) {
- 				PyRun_HandleSystemExit(v2);
- 			}
  			if (Py_FlushLine())
  				PyErr_Clear();
--- 854,862 ----
  		if (result == NULL) {
  			PyObject *exception2, *v2, *tb2;
+ 			if (PyErr_ExceptionMatches(PyExc_SystemExit)) {
+ 				handle_system_exit();
+ 			}
  			PyErr_Fetch(&exception2, &v2, &tb2);
  			PyErr_NormalizeException(&exception2, &v2, &tb2);
  			if (Py_FlushLine())
  				PyErr_Clear();