◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
3 changes: 3 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Extension Modules
Library
-------

- bpo-28298: Fix a bug that prevented array 'Q', 'L' and 'I' from accepting big
intables (objects that have __int__) as elements. Patch by Oren Milman.

Expand Down
21 changes: 16 additions & 5 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1892,12 +1892,15 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
PyObject *result;
size_t len;

stdin_encoding = _PyObject_GetAttrId(fin, &PyId_encoding);
stdin_errors = _PyObject_GetAttrId(fin, &PyId_errors);
if (!stdin_encoding || !stdin_errors)
/* stdin is a text stream, so it must have an
encoding. */
goto _readline_errors;
stdin_encoding_str = _PyUnicode_AsString(stdin_encoding);
stdin_errors_str = _PyUnicode_AsString(stdin_errors);
if (!stdin_encoding_str || !stdin_errors_str)
Expand All @@ -1913,8 +1916,12 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
PyObject *stringpo;
stdout_encoding = _PyObject_GetAttrId(fout, &PyId_encoding);
stdout_errors = _PyObject_GetAttrId(fout, &PyId_errors);
if (!stdout_encoding || !stdout_errors)
goto _readline_errors;
stdout_encoding_str = _PyUnicode_AsString(stdout_encoding);
stdout_errors_str = _PyUnicode_AsString(stdout_errors);
if (!stdout_encoding_str || !stdout_errors_str)
Expand Down Expand Up @@ -1969,13 +1976,17 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
Py_XDECREF(po);
PyMem_FREE(s);
return result;
_readline_errors:
Py_XDECREF(stdin_encoding);
Py_XDECREF(stdout_encoding);
Py_XDECREF(stdin_errors);
Py_XDECREF(stdout_errors);
Py_XDECREF(po);
return NULL;
}

/* Fallback if we're not interactive */
Expand Down
Toggle all file notes Toggle all file annotations