Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 2293:a24146241991 legacy-trunk
print class name for exceptions that are classes
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 07 Feb 1995 15:30:45 +0000 |
| parents | 618701cdf600 |
| children | 99e7ac22bd2e |
line wrap: on
line diff
--- a/Python/pythonrun.c Tue Feb 07 15:26:59 1995 +0000 +++ b/Python/pythonrun.c Tue Feb 07 15:30:45 1995 +0000 @@ -62,6 +62,8 @@ 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 @@ 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)
