summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-07 15:30:45 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-07 15:30:45 (GMT)
commit262e124107806a16ba45e2b68a76d89ebb7d2dc8 (patch)
tree2ebc0d56a66d0a025ab52b1f949b2d8cae59aacd
parent9e89f0a5b3e8bb3d907b435b6b562f2a113b03b3 (diff)
downloadcpython-262e124107806a16ba45e2b68a76d89ebb7d2dc8.zip
cpython-262e124107806a16ba45e2b68a76d89ebb7d2dc8.tar.gz
cpython-262e124107806a16ba45e2b68a76d89ebb7d2dc8.tar.bz2
print class name for exceptions that are classes
-rw-r--r--Python/pythonrun.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index c0214fc..43ff599 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -62,6 +62,8 @@ static object *run_err_node PROTO((node *n, char *filename,
object *globals, object *locals));
static object *run_node PROTO((node *n, char *filename,
object *globals, object *locals));
+static object *run_pyc_file PROTO((FILE *fp, char *filename,
+ object *globals, object *locals));
static void err_input PROTO((perrdetail *));
static void initsigs PROTO((void));
@@ -348,8 +350,18 @@ print_error()
v = message;
}
}
- if (writeobject(exception, f, PRINT_RAW) != 0)
- err_clear();
+ if (is_classobject(exception)) {
+ object* className = ((classobject*)exception)->cl_name;
+ if (className == NULL)
+ writestring("<unknown>", f);
+ else {
+ if (writeobject(className, f, PRINT_RAW) != 0)
+ err_clear();
+ }
+ } else {
+ if (writeobject(exception, f, PRINT_RAW) != 0)
+ err_clear();
+ }
if (v != NULL && v != None) {
writestring(": ", f);
if (writeobject(v, f, PRINT_RAW) != 0)