diff Python/pythonrun.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 eee3d715f0cf
children d0d0a69b5ca3
line wrap: on
line diff
--- a/Python/pythonrun.c	Mon Jan 02 18:38:42 1995 +0000
+++ b/Python/pythonrun.c	Mon Jan 02 19:04:15 1995 +0000
@@ -242,12 +242,10 @@
 void
 print_error()
 {
-	object *exception, *v, *f;
-	err_get(&exception, &v);
-	if (exception == NULL) {
-		fprintf(stderr, "print_error called but no exception\n");
-		abort();
-	}
+	object *exception, *v, *tb, *f;
+	err_fetch(&exception, &v, &tb);
+	if (exception == NULL)
+		fatal("print_error called but no exception");
 	if (exception == SystemExit) {
 		if (v == NULL || v == None)
 			goaway(0);
@@ -262,11 +260,12 @@
 	}
 	sysset("last_type", exception);
 	sysset("last_value", v);
+	sysset("last_traceback", tb);
 	f = sysget("stderr");
 	if (f == NULL)
 		fprintf(stderr, "lost sys.stderr\n");
 	else {
-		printtraceback(f);
+		tb_print(tb, f);
 		if (exception == SyntaxError) {
 			object *message;
 			char *filename, *text;
@@ -331,6 +330,7 @@
 	}
 	XDECREF(exception);
 	XDECREF(v);
+	XDECREF(tb);
 }
 
 object *
@@ -421,7 +421,6 @@
 	int start;
 {
 	node *n;
-	int err;
 	codeobject *co;
 	n = parse_string(str, start);
 	if (n == NULL)