Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 2292:01a954124577 | 2293:a24146241991 |
|---|---|
| 60 static void initmain PROTO((void)); | 60 static void initmain PROTO((void)); |
| 61 static object *run_err_node PROTO((node *n, char *filename, | 61 static object *run_err_node PROTO((node *n, char *filename, |
| 62 object *globals, object *locals)); | 62 object *globals, object *locals)); |
| 63 static object *run_node PROTO((node *n, char *filename, | 63 static object *run_node PROTO((node *n, char *filename, |
| 64 object *globals, object *locals)); | 64 object *globals, object *locals)); |
| 65 static object *run_pyc_file PROTO((FILE *fp, char *filename, | |
| 66 object *globals, object *locals)); | |
| 65 static void err_input PROTO((perrdetail *)); | 67 static void err_input PROTO((perrdetail *)); |
| 66 static void initsigs PROTO((void)); | 68 static void initsigs PROTO((void)); |
| 67 | 69 |
| 68 int debugging; /* Needed by parser.c */ | 70 int debugging; /* Needed by parser.c */ |
| 69 int verbose; /* Needed by import.c */ | 71 int verbose; /* Needed by import.c */ |
| 346 INCREF(message); | 348 INCREF(message); |
| 347 DECREF(v); | 349 DECREF(v); |
| 348 v = message; | 350 v = message; |
| 349 } | 351 } |
| 350 } | 352 } |
| 351 if (writeobject(exception, f, PRINT_RAW) != 0) | 353 if (is_classobject(exception)) { |
| 352 err_clear(); | 354 object* className = ((classobject*)exception)->cl_name; |
| 355 if (className == NULL) | |
| 356 writestring("<unknown>", f); | |
| 357 else { | |
| 358 if (writeobject(className, f, PRINT_RAW) != 0) | |
| 359 err_clear(); | |
| 360 } | |
| 361 } else { | |
| 362 if (writeobject(exception, f, PRINT_RAW) != 0) | |
| 363 err_clear(); | |
| 364 } | |
| 353 if (v != NULL && v != None) { | 365 if (v != NULL && v != None) { |
| 354 writestring(": ", f); | 366 writestring(": ", f); |
| 355 if (writeobject(v, f, PRINT_RAW) != 0) | 367 if (writeobject(v, f, PRINT_RAW) != 0) |
| 356 err_clear(); | 368 err_clear(); |
| 357 } | 369 } |
