summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-02 19:04:15 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-02 19:04:15 (GMT)
commit1ae940a5870df2f706fa884afd533847f6b0b1a8 (patch)
treeac19577f141b553bd56f998a62478719d5b81cd4 /Python/errors.c
parent824de25fe2edade0ded378b4d602351272f4cf63 (diff)
downloadcpython-1ae940a5870df2f706fa884afd533847f6b0b1a8.zip
cpython-1ae940a5870df2f706fa884afd533847f6b0b1a8.tar.gz
cpython-1ae940a5870df2f706fa884afd533847f6b0b1a8.tar.bz2
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.
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/Python/errors.c b/Python/errors.c
index bb3b605..9b0a8d2 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 <errno.h>
+#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