Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 2052:d7e91437f0a2 legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 02 Jan 1995 19:04:15 +0000 |
| parents | 9e3469c0ed75 |
| children | d0d0a69b5ca3 |
line wrap: on
line diff
--- a/Python/errors.c Mon Jan 02 18:38:42 1995 +0000 +++ b/Python/errors.c Mon Jan 02 19:04:15 1995 +0000 @@ -60,6 +60,7 @@ #include <errno.h> +#ifndef NT #ifdef macintosh /* ** For the mac, there's a function macstrerror in macosmodule.c. We can't @@ -68,9 +69,9 @@ */ #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_exc_val; void +err_restore(exception, value, traceback) + object *exception; + object *value; + object *traceback; +{ + err_clear(); + + last_exception = exception; + last_exc_val = value; + (void) tb_store(traceback); + XDECREF(traceback); +} + +void err_setval(exception, value) object *exception; object *value; { - err_clear(); - XINCREF(exception); - last_exception = exception; - XINCREF(value); - last_exc_val = value; + err_restore(exception, value, (object *)NULL); } void @@ -116,14 +127,16 @@ } 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
