summaryrefslogtreecommitdiffstats
path: root/Modules/_io/_iomodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io/_iomodule.c')
-rw-r--r--Modules/_io/_iomodule.c114
1 files changed, 1 insertions, 113 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 9ecc671..7f029f2 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -24,38 +24,6 @@
#include <windows.h>
#endif
-/* Various interned strings */
-
-PyObject *_PyIO_str_close = NULL;
-PyObject *_PyIO_str_closed = NULL;
-PyObject *_PyIO_str_decode = NULL;
-PyObject *_PyIO_str_encode = NULL;
-PyObject *_PyIO_str_fileno = NULL;
-PyObject *_PyIO_str_flush = NULL;
-PyObject *_PyIO_str_getstate = NULL;
-PyObject *_PyIO_str_isatty = NULL;
-PyObject *_PyIO_str_locale = NULL;
-PyObject *_PyIO_str_newlines = NULL;
-PyObject *_PyIO_str_nl = NULL;
-PyObject *_PyIO_str_peek = NULL;
-PyObject *_PyIO_str_read = NULL;
-PyObject *_PyIO_str_read1 = NULL;
-PyObject *_PyIO_str_readable = NULL;
-PyObject *_PyIO_str_readall = NULL;
-PyObject *_PyIO_str_readinto = NULL;
-PyObject *_PyIO_str_readline = NULL;
-PyObject *_PyIO_str_reset = NULL;
-PyObject *_PyIO_str_seek = NULL;
-PyObject *_PyIO_str_seekable = NULL;
-PyObject *_PyIO_str_setstate = NULL;
-PyObject *_PyIO_str_tell = NULL;
-PyObject *_PyIO_str_truncate = NULL;
-PyObject *_PyIO_str_writable = NULL;
-PyObject *_PyIO_str_write = NULL;
-
-PyObject *_PyIO_empty_str = NULL;
-PyObject *_PyIO_empty_bytes = NULL;
-
PyDoc_STRVAR(module_doc,
"The io module provides the Python interfaces to stream handling. The\n"
"builtin open function is defined in this module.\n"
@@ -511,8 +479,7 @@ _io_text_encoding_impl(PyObject *module, PyObject *encoding, int stacklevel)
return NULL;
}
}
- Py_INCREF(_PyIO_str_locale);
- return _PyIO_str_locale;
+ return &_Py_ID(locale);
}
Py_INCREF(encoding);
return encoding;
@@ -699,41 +666,6 @@ _PyIO_Fini(void)
PyTypeObject *exc = static_types[i];
_PyStaticType_Dealloc(exc);
}
-
- /* Interned strings */
-#define CLEAR_INTERNED(name) \
- Py_CLEAR(_PyIO_str_ ## name)
-
- CLEAR_INTERNED(close);
- CLEAR_INTERNED(closed);
- CLEAR_INTERNED(decode);
- CLEAR_INTERNED(encode);
- CLEAR_INTERNED(fileno);
- CLEAR_INTERNED(flush);
- CLEAR_INTERNED(getstate);
- CLEAR_INTERNED(isatty);
- CLEAR_INTERNED(locale);
- CLEAR_INTERNED(newlines);
- CLEAR_INTERNED(peek);
- CLEAR_INTERNED(read);
- CLEAR_INTERNED(read1);
- CLEAR_INTERNED(readable);
- CLEAR_INTERNED(readall);
- CLEAR_INTERNED(readinto);
- CLEAR_INTERNED(readline);
- CLEAR_INTERNED(reset);
- CLEAR_INTERNED(seek);
- CLEAR_INTERNED(seekable);
- CLEAR_INTERNED(setstate);
- CLEAR_INTERNED(tell);
- CLEAR_INTERNED(truncate);
- CLEAR_INTERNED(write);
- CLEAR_INTERNED(writable);
-#undef CLEAR_INTERNED
-
- Py_CLEAR(_PyIO_str_nl);
- Py_CLEAR(_PyIO_empty_str);
- Py_CLEAR(_PyIO_empty_bytes);
}
@@ -797,50 +729,6 @@ PyInit__io(void)
}
}
- /* Interned strings */
-#define ADD_INTERNED(name) \
- if (!_PyIO_str_ ## name && \
- !(_PyIO_str_ ## name = PyUnicode_InternFromString(# name))) \
- goto fail;
-
- ADD_INTERNED(close)
- ADD_INTERNED(closed)
- ADD_INTERNED(decode)
- ADD_INTERNED(encode)
- ADD_INTERNED(fileno)
- ADD_INTERNED(flush)
- ADD_INTERNED(getstate)
- ADD_INTERNED(isatty)
- ADD_INTERNED(locale)
- ADD_INTERNED(newlines)
- ADD_INTERNED(peek)
- ADD_INTERNED(read)
- ADD_INTERNED(read1)
- ADD_INTERNED(readable)
- ADD_INTERNED(readall)
- ADD_INTERNED(readinto)
- ADD_INTERNED(readline)
- ADD_INTERNED(reset)
- ADD_INTERNED(seek)
- ADD_INTERNED(seekable)
- ADD_INTERNED(setstate)
- ADD_INTERNED(tell)
- ADD_INTERNED(truncate)
- ADD_INTERNED(write)
- ADD_INTERNED(writable)
-#undef ADD_INTERNED
-
- if (!_PyIO_str_nl &&
- !(_PyIO_str_nl = PyUnicode_InternFromString("\n")))
- goto fail;
-
- if (!_PyIO_empty_str &&
- !(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0)))
- goto fail;
- if (!_PyIO_empty_bytes &&
- !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0)))
- goto fail;
-
state->initialized = 1;
return m;