From 1ae940a5870df2f706fa884afd533847f6b0b1a8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 2 Jan 1995 19:04:15 +0000 Subject: Lots of changes, most minor (fatal() instead of abort(), use of err_fetch/err_restore and so on). But... NOTE: import.c has been rewritten and all the DL stuff is now in the new file importdl.c. --- Python/errors.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'Python/errors.c') diff --git a/Python/errors.c b/Python/errors.c index bb3b605a81..9b0a8d28d8 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -60,6 +60,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include +#ifndef NT #ifdef macintosh /* ** For the mac, there's a function macstrerror in macosmodule.c. We can't @@ -68,9 +69,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define strerror macstrerror #include "macdefs.h" /* For CW to find EINTR */ -#endif /* macintosh */ - +#endif /* !macintosh */ extern char *strerror PROTO((int)); +#endif /* !NT */ /* Last exception stored by err_setval() */ @@ -78,17 +79,27 @@ static object *last_exception; static object *last_exc_val; void -err_setval(exception, value) +err_restore(exception, value, traceback) object *exception; object *value; + object *traceback; { err_clear(); - XINCREF(exception); last_exception = exception; - - XINCREF(value); last_exc_val = value; + (void) tb_store(traceback); + XDECREF(traceback); +} + +void +err_setval(exception, value) + object *exception; + object *value; +{ + XINCREF(exception); + XINCREF(value); + err_restore(exception, value, (object *)NULL); } void @@ -116,14 +127,16 @@ err_occurred() } void -err_get(p_exc, p_val) +err_fetch(p_exc, p_val, p_tb) object **p_exc; object **p_val; + object **p_tb; { *p_exc = last_exception; last_exception = NULL; *p_val = last_exc_val; last_exc_val = NULL; + *p_tb = tb_fetch(); } void -- cgit v1.2.1