[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.156,2.157

Guido van Rossum python-dev@python.org
Wed, 3 May 2000 18:03:50 -0400 (EDT)


Update of /projects/cvsroot/python/dist/src/Python
In directory eric:/projects/python/develop/guido/src/Python

Modified Files:
	bltinmodule.c 
Log Message:
A bit of cleanup:

- When 'import exceptions' fails, don't suggest to use -v to print the traceback;
  this doesn't actually work.
- Remove comment about fallback to string exceptions.
- Remove a PyErr_Occurred() check after all is said and done that can
  never trigger.
- Remove static function newstdexception() which is no longer called.


Index: bltinmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.156
retrieving revision 2.157
diff -C2 -r2.156 -r2.157
*** bltinmodule.c	2000/05/02 19:24:39	2.156
--- bltinmodule.c	2000/05/03 22:03:46	2.157
***************
*** 2441,2447 ****
  
  
! /* import exceptions module to extract class exceptions.  on success,
!  * return 1. on failure return 0 which signals _PyBuiltin_Init_2 to fall
!  * back to using old-style string based exceptions.
   */
  static int
--- 2441,2447 ----
  
  
! /* Import exceptions module to extract class exceptions.  On success,
!  * return 1.  On failure return 0 which signals _PyBuiltin_Init_2 to
!  * issue a fatal error.
   */
  static int
***************
*** 2458,2469 ****
  	    (d = PyModule_GetDict(m)) == NULL)
  	{
! 		PySys_WriteStderr("'import exceptions' failed; ");
! 		if (Py_VerboseFlag) {
! 			PySys_WriteStderr("traceback:\n");
! 			PyErr_Print();
! 		}
! 		else {
! 			PySys_WriteStderr("use -v for traceback\n");
! 		}
  		goto finally;
  	}
--- 2458,2462 ----
  	    (d = PyModule_GetDict(m)) == NULL)
  	{
! 		PySys_WriteStderr("'import exceptions' failed\n");
  		goto finally;
  	}
***************
*** 2506,2521 ****
  	/* we're done with the exceptions module */
  	Py_DECREF(m);
- 
- 	if (PyErr_Occurred()) {
- 	    PySys_WriteStderr("Cannot initialize standard class exceptions; ");
- 	    if (Py_VerboseFlag) {
- 		    PySys_WriteStderr("traceback:\n");
- 		    PyErr_Print();
- 	    }
- 	    else
- 		    PySys_WriteStderr("use -v for traceback\n");
- 	    goto finally;
- 	}
  	return 1;
    finally:
  	Py_XDECREF(m);
--- 2499,2504 ----
  	/* we're done with the exceptions module */
  	Py_DECREF(m);
  	return 1;
+ 
    finally:
  	Py_XDECREF(m);
***************
*** 2531,2546 ****
  	Py_XDECREF(PyExc_MemoryErrorInst);
  	PyExc_MemoryErrorInst = NULL;
- }
- 
- 
- static PyObject *
- newstdexception(dict, name)
- 	PyObject *dict;
- 	char *name;
- {
- 	PyObject *v = PyString_FromString(name);
- 	if (v == NULL || PyDict_SetItemString(dict, name, v) != 0)
- 		Py_FatalError("Cannot create string-based exceptions");
- 	return v;
  }
  
--- 2514,2517 ----