]> granicus.if.org Git - python/commitdiff
Issue #18408: parsetok() must not write into stderr on memory allocation error
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 11 Jul 2013 20:52:19 +0000 (22:52 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 11 Jul 2013 20:52:19 +0000 (22:52 +0200)
The caller gets an error code and can raise a classic Python exception.

Parser/parsetok.c

index 7beb735d1565e8e1bc42d0cd9dfa92821412381e..7abc612831c3f70ea06a1dc9153a59404f619a72 100644 (file)
@@ -178,7 +178,6 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
         len = b - a; /* XXX this may compute NULL - NULL */
         str = (char *) PyObject_MALLOC(len + 1);
         if (str == NULL) {
-            fprintf(stderr, "no mem for next token\n");
             err_ret->error = E_NOMEM;
             break;
         }