diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-09-13 04:40:02 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-09-13 04:40:02 (GMT) |
commit | ae66e6962e174c75963d58b31248d4edfb96b7db (patch) | |
tree | 4ad63f8d41b26945272b420bfa07b44a18943c3f | |
parent | e4c16fa364e122e5e3810b43d490208c8ff07a8e (diff) | |
parent | 0037352d9d554d06390adb7082fdcb48890dbd6c (diff) | |
download | cpython-ae66e6962e174c75963d58b31248d4edfb96b7db.zip cpython-ae66e6962e174c75963d58b31248d4edfb96b7db.tar.gz cpython-ae66e6962e174c75963d58b31248d4edfb96b7db.tar.bz2 |
Issue #27981: Merge from 3.6
-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 a29ba47..228828a 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); } } |