summaryrefslogtreecommitdiffstats
path: root/Modules/_io/_iomodule.c
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-02-29 23:31:31 (GMT)
committerBrett Cannon <brett@python.org>2012-02-29 23:31:31 (GMT)
commitefb00c0cc189c1fdee329e8b7fdd07b3fd4a54cf (patch)
tree22dc683979e0dd42d049416797b756a5c6a053cd /Modules/_io/_iomodule.c
parent54c32032aa28bdfead50714bf7861c98a9843597 (diff)
downloadcpython-efb00c0cc189c1fdee329e8b7fdd07b3fd4a54cf.zip
cpython-efb00c0cc189c1fdee329e8b7fdd07b3fd4a54cf.tar.gz
cpython-efb00c0cc189c1fdee329e8b7fdd07b3fd4a54cf.tar.bz2
Issue #14153 Create _Py_device_encoding() to prevent _io from having to import
the os module.
Diffstat (limited to 'Modules/_io/_iomodule.c')
-rw-r--r--Modules/_io/_iomodule.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 9aad479..31eea3c 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -1,9 +1,9 @@
/*
An implementation of the new I/O lib as defined by PEP 3116 - "New I/O"
-
+
Classes defined here: UnsupportedOperation, BlockingIOError.
Functions defined here: open().
-
+
Mostly written by Amaury Forgeot d'Arc
*/
@@ -510,7 +510,7 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
/* Basically the "n" format code with the ability to turn None into -1. */
-int
+int
_PyIO_ConvertSsize_t(PyObject *obj, void *result) {
Py_ssize_t limit;
if (obj == Py_None) {
@@ -537,7 +537,6 @@ iomodule_traverse(PyObject *mod, visitproc visit, void *arg) {
_PyIO_State *state = IO_MOD_STATE(mod);
if (!state->initialized)
return 0;
- Py_VISIT(state->os_module);
if (state->locale_module != NULL) {
Py_VISIT(state->locale_module);
}
@@ -551,7 +550,6 @@ iomodule_clear(PyObject *mod) {
_PyIO_State *state = IO_MOD_STATE(mod);
if (!state->initialized)
return 0;
- Py_CLEAR(state->os_module);
if (state->locale_module != NULL)
Py_CLEAR(state->locale_module);
Py_CLEAR(state->unsupported_operation);
@@ -595,11 +593,6 @@ PyInit__io(void)
state = IO_MOD_STATE(m);
state->initialized = 0;
- /* put os in the module state */
- state->os_module = PyImport_ImportModule("os");
- if (state->os_module == NULL)
- goto fail;
-
#define ADD_TYPE(type, name) \
if (PyType_Ready(type) < 0) \
goto fail; \
@@ -725,7 +718,6 @@ PyInit__io(void)
return m;
fail:
- Py_XDECREF(state->os_module);
Py_XDECREF(state->unsupported_operation);
Py_DECREF(m);
return NULL;