Issue #18408: parsetok() must not write into stderr on memory allocation error
The caller gets an error code and can raise a classic Python exception.
This commit is contained in:
parent
6b64a6803e
commit
3bf5f530d9
|
@ -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 */
|
len = b - a; /* XXX this may compute NULL - NULL */
|
||||||
str = (char *) PyObject_MALLOC(len + 1);
|
str = (char *) PyObject_MALLOC(len + 1);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
fprintf(stderr, "no mem for next token\n");
|
|
||||||
err_ret->error = E_NOMEM;
|
err_ret->error = E_NOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue