diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-12-07 05:17:43 -0700 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-07 14:17:43 +0200 |
commit | 602d307ac5e8a2da38a193dca3bdfef5994dfe67 (patch) | |
tree | 8e876e0142683a7564a391dc6396bc6d33f08639 /Parser/tokenizer.c | |
parent | 2db190bb356d00422087e1286637887efb8d97c5 (diff) | |
download | cpython-git-602d307ac5e8a2da38a193dca3bdfef5994dfe67.tar.gz |
bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. (GH-11015) (GH-11020)
(cherry picked from commit 4c49da0cb7434c676d70b9ccf38aca82ac0d64a9)
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index fbc98880c9..1a36f1c384 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -953,6 +953,11 @@ tok_nextc(struct tok_state *tok) buflen = PyBytes_GET_SIZE(u); buf = PyBytes_AS_STRING(u); newtok = PyMem_MALLOC(buflen+1); + if (newtok == NULL) { + Py_DECREF(u); + tok->done = E_NOMEM; + return EOF; + } strcpy(newtok, buf); Py_DECREF(u); } |