[Python-checkins] cpython (merge 3.5 -> 3.6): Issue #27981: Merge from 3.5

berker.peksag python-checkins at python.org
Tue Sep 13 00:39:20 EDT 2016


https://hg.python.org/cpython/rev/095c77323a6e
changeset: 103731:095c77323a6e
branch: 3.6
parent: 103728:76789ce4598b
parent: 103730:aa88456f1749
user: Berker Peksag <berker.peksag at gmail.com>
date: Tue Sep 13 07:39:40 2016 +0300
summary:
 Issue #27981: Merge from 3.5
files:
 Parser/tokenizer.c | 7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -497,7 +497,7 @@
 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 @@
 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);
 }
 }
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /