diff options
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index d38df66c69e..b14506aaca3 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -443,8 +443,6 @@ static int fp_setreadl(struct tok_state *tok, const char* enc) { PyObject *readline, *io, *stream; - _Py_IDENTIFIER(open); - _Py_IDENTIFIER(readline); int fd; long pos; @@ -462,25 +460,28 @@ fp_setreadl(struct tok_state *tok, const char* enc) } io = PyImport_ImportModule("io"); - if (io == NULL) + if (io == NULL) { return 0; - - stream = _PyObject_CallMethodId(io, &PyId_open, "isisOOO", + } + stream = _PyObject_CallMethod(io, &_Py_ID(open), "isisOOO", fd, "r", -1, enc, Py_None, Py_None, Py_False); Py_DECREF(io); - if (stream == NULL) + if (stream == NULL) { return 0; + } - readline = _PyObject_GetAttrId(stream, &PyId_readline); + readline = PyObject_GetAttr(stream, &_Py_ID(readline)); Py_DECREF(stream); - if (readline == NULL) + if (readline == NULL) { return 0; + } Py_XSETREF(tok->decoding_readline, readline); if (pos > 0) { PyObject *bufobj = _PyObject_CallNoArgs(readline); - if (bufobj == NULL) + if (bufobj == NULL) { return 0; + } Py_DECREF(bufobj); } |