bpo-41006: Remove init_sys_streams() hack (GH-20954)
The encodings.latin_1 module is no longer imported at startup. Now it is only imported when it is the filesystem encoding or the stdio encoding.
This commit is contained in:
parent
4c18fc8f1d
commit
1bf7959dce
|
@ -0,0 +1,2 @@
|
||||||
|
The ``encodings.latin_1`` module is no longer imported at startup. Now it is
|
||||||
|
only imported when it is the filesystem encoding or the stdio encoding.
|
|
@ -1939,7 +1939,6 @@ static PyStatus
|
||||||
init_sys_streams(PyThreadState *tstate)
|
init_sys_streams(PyThreadState *tstate)
|
||||||
{
|
{
|
||||||
PyObject *iomod = NULL;
|
PyObject *iomod = NULL;
|
||||||
PyObject *m;
|
|
||||||
PyObject *std = NULL;
|
PyObject *std = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
PyObject * encoding_attr;
|
PyObject * encoding_attr;
|
||||||
|
@ -1959,18 +1958,6 @@ init_sys_streams(PyThreadState *tstate)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Hack to avoid a nasty recursion issue when Python is invoked
|
|
||||||
in verbose mode: pre-import the Latin-1 and UTF-8 codecs */
|
|
||||||
if ((m = PyImport_ImportModule("encodings.utf_8")) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
Py_DECREF(m);
|
|
||||||
|
|
||||||
if (!(m = PyImport_ImportModule("encodings.latin_1"))) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
Py_DECREF(m);
|
|
||||||
|
|
||||||
if (!(iomod = PyImport_ImportModule("io"))) {
|
if (!(iomod = PyImport_ImportModule("io"))) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue