comparison Python/pythonrun.c @ 28325:850626d47574 legacy-trunk

Fixed SF bug #663074. The codec system was using global static variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure.
author Gustavo Niemeyer <gustavo@niemeyer.net>
date Wed, 19 Mar 2003 00:35:36 +0000
parents 04df965d675b
children be2ecafb15ad
comparison
equal deleted inserted replaced
28324:4e221368af70 28325:850626d47574
47 static void initsigs(void); 47 static void initsigs(void);
48 static void call_sys_exitfunc(void); 48 static void call_sys_exitfunc(void);
49 static void call_ll_exitfuncs(void); 49 static void call_ll_exitfuncs(void);
50 extern void _PyUnicode_Init(void); 50 extern void _PyUnicode_Init(void);
51 extern void _PyUnicode_Fini(void); 51 extern void _PyUnicode_Fini(void);
52 extern void _PyCodecRegistry_Init(void);
53 extern void _PyCodecRegistry_Fini(void);
54 52
55 int Py_DebugFlag; /* Needed by parser.c */ 53 int Py_DebugFlag; /* Needed by parser.c */
56 int Py_VerboseFlag; /* Needed by import.c */ 54 int Py_VerboseFlag; /* Needed by import.c */
57 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ 55 int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
58 int Py_NoSiteFlag; /* Suppress 'import site' */ 56 int Py_NoSiteFlag; /* Suppress 'import site' */
141 Py_FatalError("Py_Initialize: can't init ints"); 139 Py_FatalError("Py_Initialize: can't init ints");
142 140
143 interp->modules = PyDict_New(); 141 interp->modules = PyDict_New();
144 if (interp->modules == NULL) 142 if (interp->modules == NULL)
145 Py_FatalError("Py_Initialize: can't make modules dictionary"); 143 Py_FatalError("Py_Initialize: can't make modules dictionary");
146
147 /* Init codec registry */
148 _PyCodecRegistry_Init();
149 144
150 #ifdef Py_USING_UNICODE 145 #ifdef Py_USING_UNICODE
151 /* Init Unicode implementation; relies on the codec registry */ 146 /* Init Unicode implementation; relies on the codec registry */
152 _PyUnicode_Init(); 147 _PyUnicode_Init();
153 #endif 148 #endif
254 tstate = PyThreadState_Get(); 249 tstate = PyThreadState_Get();
255 interp = tstate->interp; 250 interp = tstate->interp;
256 251
257 /* Disable signal handling */ 252 /* Disable signal handling */
258 PyOS_FiniInterrupts(); 253 PyOS_FiniInterrupts();
259
260 /* Cleanup Codec registry */
261 _PyCodecRegistry_Fini();
262 254
263 /* drop module references we saved */ 255 /* drop module references we saved */
264 Py_XDECREF(PyModule_WarningsModule); 256 Py_XDECREF(PyModule_WarningsModule);
265 PyModule_WarningsModule = NULL; 257 PyModule_WarningsModule = NULL;
266 258