Index: Objects/unicodeobject.c =================================================================== --- Objects/unicodeobject.c (revision 85790) +++ Objects/unicodeobject.c (working copy) @@ -9882,8 +9882,8 @@ }; /* Initialize the Unicode implementation */ - -void _PyUnicode_Init(void) +static int globals_initialized = 0; +void _PyUnicode_InitGlobals(void) { int i; @@ -9908,14 +9908,21 @@ for (i = 0; i < 256; i++) unicode_latin1[i] = NULL; - if (PyType_Ready(&PyUnicode_Type) < 0) - Py_FatalError("Can't initialize 'unicode'"); /* initialize the linebreak bloom filter */ bloom_linebreak = make_bloom_mask( linebreak, sizeof(linebreak) / sizeof(linebreak[0]) ); + globals_initialized = 1; +} + +void _PyUnicode_Init(void) +{ + if (!globals_initialized) + _PyUnicode_InitGlobals(); + if (PyType_Ready(&PyUnicode_Type) < 0) + Py_FatalError("Can't initialize 'unicode'"); PyType_Ready(&EncodingMapType); } Index: Modules/main.c =================================================================== --- Modules/main.c (revision 85790) +++ Modules/main.c (working copy) @@ -327,6 +327,7 @@ orig_argc = argc; /* For Py_GetArgcArgv() */ orig_argv = argv; + _PyUnicode_InitGlobals(); PySys_ResetWarnOptions(); while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {