diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-09-13 07:39:40 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-09-13 07:39:40 +0300 |
commit | 0037352d9d554d06390adb7082fdcb48890dbd6c (patch) | |
tree | eef3832cce89e0dc808cc81a4a1350cacd29c7ef | |
parent | b5d67b7278126f50abedd835b89da8a718130d03 (diff) | |
parent | 720acbf31b960bd6fb5f6bf2ad6a3e319428749c (diff) | |
download | cpython-git-0037352d9d554d06390adb7082fdcb48890dbd6c.tar.gz |
Issue #27981: Merge from 3.5
-rw-r--r-- | Parser/tokenizer.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index a29ba472aa..228828a32d 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -497,7 +497,7 @@ error: static int fp_setreadl(struct tok_state *tok, const char* enc) { - PyObject *readline = NULL, *stream = NULL, *io = NULL; + PyObject *readline = NULL, *stream = NULL, *io = NULL, *bufobj; _Py_IDENTIFIER(open); _Py_IDENTIFIER(readline); int fd; @@ -528,9 +528,12 @@ fp_setreadl(struct tok_state *tok, const char* enc) readline = _PyObject_GetAttrId(stream, &PyId_readline); Py_XSETREF(tok->decoding_readline, readline); if (pos > 0) { - if (PyObject_CallObject(readline, NULL) == NULL) { + bufobj = PyObject_CallObject(readline, NULL); + if (bufobj == NULL) { readline = NULL; goto cleanup; + } else { + Py_DECREF(bufobj); } } |