]> granicus.if.org Git - python/commitdiff
Fix a bug in stack overflow error handling. This fixes half of Bug
authorGuido van Rossum <guido@python.org>
Mon, 2 Oct 2000 10:21:59 +0000 (10:21 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 2 Oct 2000 10:21:59 +0000 (10:21 +0000)
#115555.

The error from s_push() on stack overflow was -1, which was passed
through unchanged by push(), but not tested for by push()'s caller --
which only expected positive error codes.  Fixed by changing s_push()
to return E_NOMEM on stack overflow.  (Not quite the proper error code
either, but I can't be bothered adding a new E_STACKOVERFLOW error
code in all the right places.)

Parser/parser.c

index d379f604b734e262940e315b6e9bdcc27cfceecc..6eaa925ef3c5da21780ff863d2d2eba04e31fa4c 100644 (file)
@@ -40,7 +40,7 @@ s_push(register stack *s, dfa *d, node *parent)
        register stackentry *top;
        if (s->s_top == s->s_base) {
                fprintf(stderr, "s_push: parser stack overflow\n");
-               return -1;
+               return E_NOMEM;
        }
        top = --s->s_top;
        top->s_dfa = d;