mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Patch 1352 (continued in issue 1329) by Christian Heimes.
Before sys.stderr is set to the proper thing, set it to a really simple file-like object that can print tracebacks using direct file descriptor I/O. This is handy for debugging.
This commit is contained in:
parent
1cd5bd2a2e
commit
826d8973ac
4 changed files with 136 additions and 1 deletions
|
@ -151,7 +151,7 @@ Py_InitializeEx(int install_sigs)
|
|||
{
|
||||
PyInterpreterState *interp;
|
||||
PyThreadState *tstate;
|
||||
PyObject *bimod, *sysmod;
|
||||
PyObject *bimod, *sysmod, *pstderr;
|
||||
char *p;
|
||||
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
|
||||
char *codeset;
|
||||
|
@ -228,6 +228,13 @@ Py_InitializeEx(int install_sigs)
|
|||
PyDict_SetItemString(interp->sysdict, "modules",
|
||||
interp->modules);
|
||||
|
||||
/* Set up a preliminary stderr printer until we have enough
|
||||
infrastructure for the io module in place. */
|
||||
pstderr = PyFile_NewStdPrinter(fileno(stderr));
|
||||
if (pstderr == NULL)
|
||||
Py_FatalError("Py_Initialize: can't set preliminary stderr");
|
||||
PySys_SetObject("stderr", pstderr);
|
||||
|
||||
_PyImport_Init();
|
||||
|
||||
/* initialize builtin exceptions */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue