]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
printobject now returns an error code
authorGuido van Rossum <guido@python.org>
Fri, 7 Jun 1991 22:35:42 +0000 (22:35 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 7 Jun 1991 22:35:42 +0000 (22:35 +0000)
Include/object.h
Modules/stdwinmodule.c
Python/pythonmain.c
Python/traceback.c

index 5a930002fcffaaef1784732e8db2728a7d8eee04..750cd80c0b168d1815e2b450b396df0ad952f861 100644 (file)
@@ -162,7 +162,7 @@ typedef struct _typeobject {
        /* Methods to implement standard operations */
        
        void (*tp_dealloc) FPROTO((object *));
-       void (*tp_print) FPROTO((object *, FILE *, int));
+       int (*tp_print) FPROTO((object *, FILE *, int));
        object *(*tp_getattr) FPROTO((object *, char *));
        int (*tp_setattr) FPROTO((object *, char *, object *));
        int (*tp_compare) FPROTO((object *, object *));
@@ -180,7 +180,7 @@ extern typeobject Typetype; /* The type of type objects */
 #define is_typeobject(op) ((op)->ob_type == &Typetype)
 
 /* Generic operations on objects */
-extern void printobject PROTO((object *, FILE *, int));
+extern int printobject PROTO((object *, FILE *, int));
 extern object * reprobject PROTO((object *));
 extern int cmpobject PROTO((object *, object *));
 extern object *getattr PROTO((object *, char *));
index 494b15ea3015a93f7f30438d3ce999364b62944a..9b436afb4760354c5f1ac6c8a6aa5a82bac4ed2c 100644 (file)
@@ -1286,13 +1286,14 @@ window_dealloc(wp)
        free((char *)wp);
 }
 
-static void
+static int
 window_print(wp, fp, flags)
        windowobject *wp;
        FILE *fp;
        int flags;
 {
        fprintf(fp, "<window titled '%s'>", getstringvalue(wp->w_title));
+       return 0;
 }
 
 static object *
index b8555207006ec08de36a1c28e9dd4f5805656e10..9fa1a588dbe1dfe1d22ba035a0d53a3790961706 100644 (file)
@@ -289,10 +289,12 @@ print_error()
        object *exception, *v;
        err_get(&exception, &v);
        fprintf(stderr, "Unhandled exception: ");
-       printobject(exception, stderr, PRINT_RAW);
+       if (printobject(exception, stderr, PRINT_RAW) != 0)
+               err_clear();
        if (v != NULL && v != None) {
                fprintf(stderr, ": ");
-               printobject(v, stderr, PRINT_RAW);
+               if (printobject(v, stderr, PRINT_RAW) != 0)
+                       err_clear();
        }
        fprintf(stderr, "\n");
        XDECREF(exception);
index 0b6904f6b29e992833f0d3cc6a91f2d6539bf7a0..e71f6fa160300f09bf1d52c5046da1149c7d4311 100644 (file)
@@ -186,12 +186,14 @@ tb_printinternal(tb, fp)
        FILE *fp;
 {
        while (tb != NULL) {
-               if (intrcheck()) {
-                       fprintf(fp, "[interrupted]\n");
+               if (intrcheck())
                        break;
-               }
                fprintf(fp, "  File \"");
-               printobject(tb->tb_frame->f_code->co_filename, fp, PRINT_RAW);
+               if (printobject(tb->tb_frame->f_code->co_filename,
+                               fp, PRINT_RAW) != 0) {
+                       err_clear();
+                       break;
+               }
                fprintf(fp, "\", line %d\n", tb->tb_lineno);
                tb_displayline(fp,
                     getstringvalue(tb->tb_frame->f_code->co_filename),