From c94044c11d5e1f61443163d1c5ea44019d7c5871 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 10 Mar 2000 23:03:54 +0000 Subject: [PATCH] Marc-Andre Lemburg: add calls to initialize and finalize Unicode and Codec registry. --- Python/pythonrun.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 0814038ee20..eb93d47ebe5 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -76,6 +76,12 @@ static void call_ll_exitfuncs Py_PROTO((void)); int _Py_AskYesNo(char *prompt); #endif +extern void _PyUnicode_Init(); +extern void _PyUnicode_Fini(); +extern void _PyCodecRegistry_Init(); +extern void _PyCodecRegistry_Fini(); + + int Py_DebugFlag; /* Needed by parser.c */ int Py_VerboseFlag; /* Needed by import.c */ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ @@ -137,6 +143,12 @@ Py_Initialize() if (interp->modules == NULL) Py_FatalError("Py_Initialize: can't make modules dictionary"); + /* Init codec registry */ + _PyCodecRegistry_Init(); + + /* Init Unicode implementation; relies on the codec registry */ + _PyUnicode_Init(); + bimod = _PyBuiltin_Init_1(); if (bimod == NULL) Py_FatalError("Py_Initialize: can't initialize __builtin__"); @@ -206,6 +218,12 @@ Py_Finalize() /* Destroy PyExc_MemoryErrorInst */ _PyBuiltin_Fini_1(); + /* Cleanup Unicode implementation */ + _PyUnicode_Fini(); + + /* Cleanup Codec registry */ + _PyCodecRegistry_Fini(); + /* Destroy all modules */ PyImport_Cleanup();