Patch written by Andrei Dorian Duma.
Py_buffer buf;
Py_ssize_t len;
PyObject *data;
- _Py_IDENTIFIER(read);
if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) {
return NULL;
#define IS_CLOSED(self) \
_PyObject_HasAttrId(self, &PyId___IOBase_closed)
+_Py_IDENTIFIER(read);
+
/* Internal methods */
static PyObject *
iobase_unsupported(const char *message)
iobase_close(PyObject *self, PyObject *args)
{
PyObject *res;
- _Py_IDENTIFIER(__IOBase_closed);
if (IS_CLOSED(self))
Py_RETURN_NONE;
int has_peek = 0;
PyObject *buffer, *result;
Py_ssize_t old_size = -1;
- _Py_IDENTIFIER(read);
_Py_IDENTIFIER(peek);
if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) {
return NULL;
while (1) {
- _Py_IDENTIFIER(read);
PyObject *data = _PyObject_CallMethodId(self, &PyId_read,
"i", DEFAULT_BUFFER_SIZE);
if (!data) {
#define MBENC_RESET MBENC_MAX<<1 /* reset after an encoding session */
+_Py_IDENTIFIER(write);
+
static PyObject *
make_tuple(PyObject *object, Py_ssize_t len)
{
PyObject *unistr)
{
PyObject *str, *wr;
- _Py_IDENTIFIER(write);
str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0);
if (str == NULL)
assert(PyBytes_Check(pwrt));
if (PyBytes_Size(pwrt) > 0) {
PyObject *wr;
- _Py_IDENTIFIER(write);
wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt);
if (wr == NULL) {
PyObject *func;
PyObject *newargs, *x;
Py_ssize_t i, n;
- _Py_IDENTIFIER(__new__);
func = _PyObject_GetAttrId((PyObject *)type, &PyId___new__);
if (func == NULL)
_Py_IDENTIFIER(builtins);
_Py_IDENTIFIER(excepthook);
+_Py_IDENTIFIER(flush);
_Py_IDENTIFIER(last_traceback);
_Py_IDENTIFIER(last_type);
_Py_IDENTIFIER(last_value);
+_Py_IDENTIFIER(name);
_Py_IDENTIFIER(ps1);
_Py_IDENTIFIER(ps2);
_Py_IDENTIFIER(stdin);
{
char *name_utf8, *name_str;
PyObject *codec, *name = NULL;
- _Py_IDENTIFIER(name);
codec = _PyCodec_Lookup(encoding);
if (!codec)
PyObject *fout = _PySys_GetObjectId(&PyId_stdout);
PyObject *ferr = _PySys_GetObjectId(&PyId_stderr);
PyObject *tmp;
- _Py_IDENTIFIER(flush);
if (fout != NULL && fout != Py_None && !file_is_closed(fout)) {
tmp = _PyObject_CallMethodId(fout, &PyId_flush, "");
_Py_IDENTIFIER(open);
_Py_IDENTIFIER(isatty);
_Py_IDENTIFIER(TextIOWrapper);
- _Py_IDENTIFIER(name);
_Py_IDENTIFIER(mode);
/* stdin is always opened in buffered mode, first because it shouldn't
{
PyObject *f, *r;
PyObject *type, *value, *traceback;
- _Py_IDENTIFIER(flush);
/* Save the current exception */
PyErr_Fetch(&type, &value, &traceback);