From: Guido van Rossum Date: Tue, 7 Feb 1995 15:30:45 +0000 (+0000) Subject: print class name for exceptions that are classes X-Git-Tag: v1.2b3~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=262e124107806a16ba45e2b68a76d89ebb7d2dc8;p=thirdparty%2FPython%2Fcpython.git print class name for exceptions that are classes --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index c0214fc1e584..43ff59914266 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("", 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)