]> granicus.if.org Git - python/commitdiff
Apply two changes, systematically:
authorGuido van Rossum <guido@python.org>
Wed, 1 Oct 1997 04:29:29 +0000 (04:29 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 1 Oct 1997 04:29:29 +0000 (04:29 +0000)
(1) Use PyErr_NewException("module.class", NULL, NULL) to create the
    exception object.

(2) Remove all calls to Py_FatalError(); instead, return or
    ignore the errors -- the import code now checks PyErr_Occurred()
    after calling a module's init function, so it's no longer a
    fatal error for the initialization to fail.

Also did some small cleanups, e.g. removed unnecessary test for
"already initialized" from initfpectl(), and unified
initposix()/initnt().

I haven't checked this very thoroughly, so while the changes are
pretty trivial -- beware of untested code!

27 files changed:
Modules/_cursesmodule.c
Modules/audioop.c
Modules/bsddbmodule.c
Modules/clmodule.c
Modules/dbmmodule.c
Modules/dlmodule.c
Modules/fpectlmodule.c
Modules/fpetestmodule.c
Modules/gdbmmodule.c
Modules/imageop.c
Modules/imgfile.c
Modules/nismodule.c
Modules/posixmodule.c
Modules/regexmodule.c
Modules/reopmodule.c
Modules/resource.c
Modules/rgbimgmodule.c
Modules/selectmodule.c
Modules/socketmodule.c
Modules/stdwinmodule.c
Modules/structmodule.c
Modules/sunaudiodev.c
Modules/svmodule.c
Modules/termios.c
Modules/threadmodule.c
Modules/xxmodule.c
Modules/zlibmodule.c

index 8e852566eaf825a8a7a013306a7321b0bb5cbf56..a176225cc4ca1e2a87fd05244166dacd01d3180e 100644 (file)
@@ -1535,7 +1535,7 @@ initcurses()
        ModDict = d; /* For PyCurses_InitScr */
 
        /* For exception curses.error */
-       PyCursesError = PyString_FromString("curses.error");
+       PyCursesError = PyErr_NewException("curses.error", NULL, NULL);
        PyDict_SetItemString(d, "error", PyCursesError);
 
        /* Make the version available */
@@ -1585,8 +1585,4 @@ initcurses()
          SetDictInt("KEY_MIN", KEY_MIN);
          SetDictInt("KEY_MAX", KEY_MAX);
        }
-
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module curses");
 }
index fc33bcd1a5e5c9ed5706dccec2b0d0a4566f5b7a..c6d9df5bcb98f121dfb16ca26bb4e1650c88b634 100644 (file)
@@ -1396,8 +1396,7 @@ initaudioop()
        PyObject *m, *d;
        m = Py_InitModule("audioop", audioop_methods);
        d = PyModule_GetDict(m);
-       AudioopError = PyString_FromString("audioop.error");
-       if ( AudioopError == NULL
-            || PyDict_SetItemString(d,"error",AudioopError) )
-               Py_FatalError("can't define audioop.error");
+       AudioopError = PyErr_NewException("audioop.error", NULL, NULL);
+       if (AudioopError != NULL)
+            PyDict_SetItemString(d,"error",AudioopError);
 }
index 0c9915a062959d7b68e3a55e56654961d39ad177..ee979b89e29db07d970a5fcfa470700960d8fb16 100644 (file)
@@ -746,7 +746,7 @@ initbsddb() {
        Bsddbtype.ob_type = &PyType_Type;
        m = Py_InitModule("bsddb", bsddbmodule_methods);
        d = PyModule_GetDict(m);
-       BsddbError = PyString_FromString("bsddb.error");
-       if (BsddbError == NULL || PyDict_SetItemString(d, "error", BsddbError))
-               Py_FatalError("can't define bsddb.error");
+       BsddbError = PyErr_NewException("bsddb.error", NULL, NULL);
+       if (BsddbError != NULL)
+               PyDict_SetItemString(d, "error", BsddbError);
 }
index 1550e58310229ef7fe5a3f0d81ff7db4c72bf01c..b8bac317e962f0382719238596c710c1fd448b24 100644 (file)
@@ -1006,7 +1006,7 @@ initcl()
        m = Py_InitModule("cl", cl_methods);
        d = PyModule_GetDict(m);
 
-       ClError = PyString_FromString("cl.error");
+       ClError = PyErr_NewException("cl.error", NULL, NULL);
        (void) PyDict_SetItemString(d, "error", ClError);
 
 #ifdef CL_ADDED_ALGORITHM_ERROR
@@ -2594,10 +2594,5 @@ initcl()
        Py_DECREF(x);
 #endif
 
-       if (PyErr_Occurred()) {
-         error:
-               Py_FatalError("can't initialize module cl");
-       }
-
        (void) clSetErrorHandler(cl_ErrorHandler);
 }
index 0b0cb70afb1eff20aed17e08ac118252d7fe5e29..ea628f196eb8dd3698fba476a1b04d8aacede71d 100644 (file)
@@ -317,7 +317,7 @@ initdbm() {
 
        m = Py_InitModule("dbm", dbmmodule_methods);
        d = PyModule_GetDict(m);
-       DbmError = PyString_FromString("dbm.error");
-       if ( DbmError == NULL || PyDict_SetItemString(d, "error", DbmError) )
-               Py_FatalError("can't define dbm.error");
+       DbmError = PyErr_NewException("dbm.error", NULL, NULL);
+       if (DbmError != NULL)
+               PyDict_SetItemString(d, "error", DbmError);
 }
index d94665887382b10d177c5964d22f592d76b00389..9d7ce71d81d33a9cc3aee57d68208ccb35f6de09 100644 (file)
@@ -229,16 +229,18 @@ initdl()
        PyObject *m, *d, *x;
 
        if (sizeof(int) != sizeof(long) ||
-           sizeof(long) != sizeof(char *))
-               Py_FatalError(
+           sizeof(long) != sizeof(char *)) {
+               Py_Err_SetStr(
  "module dl requires sizeof(int) == sizeof(long) == sizeof(char*)");
+               return;
+       }
 
        /* Create the module and add the functions */
        m = Py_InitModule("dl", dl_methods);
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
-       Dlerror = x = PyString_FromString("dl.error");
+       Dlerror = x = PyErr_NewException("dl.error", NULL, NULL);
        PyDict_SetItemString(d, "error", x);
        x = PyInt_FromLong((long)RTLD_LAZY);
        PyDict_SetItemString(d, "RTLD_LAZY", x);
@@ -246,8 +248,4 @@ initdl()
        x = PyInt_FromLong((long)RTLD_NOW);
        PyDict_SetItemString(d, "RTLD_NOW", x);
 #endif
-
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module dl");
 }
index 0b7e8d77dea0572c533a89e6dc17abb02591e110..b0ba9dbc4b916a9d90ec6208803c796eea84ec1d 100644 (file)
@@ -227,17 +227,11 @@ static void sigfpe_handler(int signo)
 void initfpectl(void)
 {
     PyObject *m, *d;
-    static int already_initialized = 0;
-
-    if (already_initialized) return;
     m = Py_InitModule("fpectl", fpectl_methods);
     d = PyModule_GetDict(m);
-    fpe_error = PyString_FromString("fpectl.error");
-    PyDict_SetItemString(d, "error", fpe_error);
-
-    if (PyErr_Occurred())
-       Py_FatalError("Cannot initialize module fpectl");
-    already_initialized = 1;
+    fpe_error = PyErr_NewException("fpectl.error", NULL, NULL);
+    if (fpe_error != NULL)
+       PyDict_SetItemString(d, "error", fpe_error);
 }
 
 #ifdef __cplusplus
index b568b60eb0c6af4f115f130b968481dd97da3509..61dd3db734d25c9b9d6387cfd7c2df7b6afc3f38 100644 (file)
@@ -178,9 +178,7 @@ void initfpetest(void)
 
     m = Py_InitModule("fpetest", fpetest_methods);
     d = PyModule_GetDict(m);
-    fpe_error = PyString_FromString("fpetest.error");
-    PyDict_SetItemString(d, "error", fpe_error);
-
-    if (PyErr_Occurred())
-       Py_FatalError("Cannot initialize module fpetest");
+    fpe_error = PyErr_NewException("fpetest.error", NULL, NULL);
+    if (fpe_error != NULL)
+           PyDict_SetItemString(d, "error", fpe_error);
 }
index 23ec8315d03e204e8adc7f95e91957777c38afaf..8c870c03e7564f0e0d075a31eeffe8f0ddbbbf92 100644 (file)
@@ -432,7 +432,7 @@ initgdbm() {
 
        m = Py_InitModule("gdbm", dbmmodule_methods);
        d = PyModule_GetDict(m);
-       DbmError = PyString_FromString("gdbm.error");
-       if ( DbmError == NULL || PyDict_SetItemString(d, "error", DbmError) )
-               Py_FatalError("can't define gdbm.error");
+       DbmError = PyErr_NewException("gdbm.error", NULL, NULL);
+       if (DbmError != NULL)
+               PyDict_SetItemString(d, "error", DbmError);
 }
index 007c83e0918906bf2420e077b1bbea0080300ac0..049908da354d752597c01670a0a890a725e97304 100644 (file)
@@ -752,8 +752,7 @@ initimageop()
        PyObject *m, *d;
        m = Py_InitModule("imageop", imageop_methods);
        d = PyModule_GetDict(m);
-       ImageopError = PyString_FromString("imageop.error");
-       if ( ImageopError == NULL ||
-            PyDict_SetItemString(d,"error",ImageopError) )
-               Py_FatalError("can't define imageop.error");
+       ImageopError = PyErr_NewException("imageop.error", NULL, NULL);
+       if (ImageopError != NULL)
+               PyDict_SetItemString(d, "error", ImageopError);
 }
index 865ecab4122fb047ec58953c304232b813930b56..65976c10cd60f6c4e816d9cbb8fb1dd629ddf98f 100644 (file)
@@ -560,10 +560,9 @@ initimgfile()
        PyObject *m, *d;
        m = Py_InitModule("imgfile", imgfile_methods);
        d = PyModule_GetDict(m);
-       ImgfileError = PyString_FromString("imgfile.error");
-       if ( ImgfileError == NULL
-        || PyDict_SetItemString(d, "error", ImgfileError) )
-               Py_FatalError("can't define imgfile.error");
+       ImgfileError = PyErr_NewException("imgfile.error", NULL, NULL);
+       if (ImgfileError != NULL)
+               PyDict_SetItemString(d, "error", ImgfileError);
 }
 
 
index 586602699ae6d6e569f32b2e14ba81b421bd6814..cadbad0595ec2b946a5b99411f2f64930d7c2175 100644 (file)
@@ -370,8 +370,7 @@ initnis ()
        PyObject *m, *d;
        m = Py_InitModule("nis", nis_methods);
        d = PyModule_GetDict(m);
-       NisError = PyString_FromString("nis.error");
-       if (NisError == NULL ||
-           PyDict_SetItemString(d, "error", NisError) != 0)
-               Py_FatalError("Cannot define nis.error");
+       NisError = PyErr_NewException("nis.error", NULL, NULL);
+       if (NisError != NULL)
+               PyDict_SetItemString(d, "error", NisError);
 }
index 3069d34be788610988e8ae787793861486c33c3a..e06827aa720d64748ff48504c3949362691679be 100644 (file)
@@ -2254,73 +2254,37 @@ all_ins(d)
 }
 
 
-/* XXX The following should be more unified -- only difference left is
-   function name and module name. */
-
 #if defined(_MSC_VER) || defined(__WATCOMC__)
-void
-initnt()
-{
-       PyObject *m, *d, *v;
-       
-       m = Py_InitModule4("nt", 
-                          posix_methods,
-                          posix__doc__,
-                         (PyObject *)NULL,
-                         PYTHON_API_VERSION);
-       d = PyModule_GetDict(m);
-       
-       /* Initialize nt.environ dictionary */
-       v = convertenviron();
-       if (v == NULL || PyDict_SetItemString(d, "environ", v) != 0)
-               goto finally;
-       Py_DECREF(v);
-       
-        if (all_ins(d))
-                goto finally;
-
-       /* Initialize nt.error exception */
-       PosixError = PyString_FromString("os.error");
-       PyDict_SetItemString(d, "error", PosixError);
-
-        if (!PyErr_Occurred())
-                return;
+#define INITFUNC initnt
+#define MODNAME "nt"
+#else
+#define INITFUNC initposix
+#define MODNAME "posix"
+#endif
 
-  finally:
-       /* XXX Shouldn't */
-        Py_FatalError("can't initialize NT posixmodule");
-}
-#else /* not a PC port */
 void
-initposix()
+INITFUNC()
 {
        PyObject *m, *d, *v;
        
-       m = Py_InitModule4("posix", 
+       m = Py_InitModule4(MODNAME,
                           posix_methods,
                           posix__doc__,
-                         (PyObject *)NULL,
-                         PYTHON_API_VERSION);
+                          (PyObject *)NULL,
+                          PYTHON_API_VERSION);
        d = PyModule_GetDict(m);
        
-       /* Initialize posix.environ dictionary */
+       /* Initialize environ dictionary */
        v = convertenviron();
        if (v == NULL || PyDict_SetItemString(d, "environ", v) != 0)
-                goto finally;
+               return;
        Py_DECREF(v);
        
         if (all_ins(d))
-                goto finally;
-
-       /* Initialize posix.error exception */
-       PosixError = PyString_FromString("os.error");
-       PyDict_SetItemString(d, "error", PosixError);
-
-        if (!PyErr_Occurred())
                 return;
 
-  finally:
-       /* XXX Shouldn't */
-        Py_FatalError("can't initialize posix module");
+       /* Initialize exception */
+       PosixError = PyErr_NewException("os.error", NULL, NULL);
+       if (PosixError != NULL)
+               PyDict_SetItemString(d, "error", PosixError);
 }
-#endif /* !_MSC_VER */
index 981dc8ca26ec24c725f05adc2736cacff2f204b5..7a289d5c4ecd05841e68d1b125312eaccd341b15 100644 (file)
@@ -718,7 +718,7 @@ initregex()
        d = PyModule_GetDict(m);
        
        /* Initialize regex.error exception */
-       v = RegexError = PyString_FromString("regex.error");
+       v = RegexError = PyErr_NewException("regex.error", NULL, NULL);
        if (v == NULL || PyDict_SetItemString(d, "error", v) != 0)
                goto finally;
        
@@ -742,5 +742,5 @@ initregex()
        if (!PyErr_Occurred())
                return;
   finally:
-       Py_FatalError("can't initialize regex module");
+       /* Nothing */ ;
 }
index de5c63d3ce97c20b1bfdca0b8a0ba2e426772186..6c671c898ac3bf347d34ca94399f4fb2e80fcfb1 100644 (file)
@@ -958,7 +958,7 @@ initreop()
        d = PyModule_GetDict(m);
        
        /* Initialize reop.error exception */
-       v = ReopError = PyString_FromString("reop.error");
+       v = ReopError = PyErr_NewException("reop.error", NULL, NULL);
        if (v == NULL || PyDict_SetItemString(d, "error", v) != 0)
                goto finally;
        
@@ -1048,6 +1048,6 @@ initreop()
                return;
 
   finally:
-       Py_FatalError("can't initialize reop module");
+       /* Nothing */;
 }
 
index 428c32c03f8cbe75ef486f7f175a99374d7ead35..9518ed61bf31b140e8c65213038849f0867f88bb 100644 (file)
@@ -201,7 +201,7 @@ void initresource()
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
-       ResourceError = PyString_FromString("resource.error");
+       ResourceError = PyErr_NewException("resource.error", NULL, NULL);
        PyDict_SetItemString(d, "error", ResourceError);
 
        /* insert constants */
@@ -264,8 +264,4 @@ void initresource()
 #ifdef RUSAGE_BOTH
        ins(d, "RUSAGE_BOTH", RUSAGE_BOTH);
 #endif
-
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module resource");
 }
index 18d2776e3133affe2603c32c6f5a05d8c3b43ec2..36f64193e87098dfda694d8a6a1b8f0690bf336f 100644 (file)
@@ -782,9 +782,7 @@ initrgbimg()
        PyObject *m, *d;
        m = Py_InitModule("rgbimg", rgbimg_methods);
        d = PyModule_GetDict(m);
-       ImgfileError = PyString_FromString("rgbimg.error");
-       if (ImgfileError)
+       ImgfileError = PyErr_NewException("rgbimg.error", NULL, NULL);
+       if (ImgfileError != NULL)
                PyDict_SetItemString(d, "error", ImgfileError);
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize rgbimg module");
 }
index 047c0d437c8b42cb75ac23ab12f59c005b8edb4a..7655c3c8b01c5c13ad304ccf5e80531f910f58d4 100644 (file)
@@ -322,8 +322,6 @@ initselect()
        PyObject *m, *d;
        m = Py_InitModule("select", select_methods);
        d = PyModule_GetDict(m);
-       SelectError = PyString_FromString("select.error");
+       SelectError = PyErr_NewException("select.error", NULL, NULL);
        PyDict_SetItemString(d, "error", SelectError);
-       if (PyErr_Occurred())
-               Py_FatalError("Cannot initialize select module");
 }
index 48ce55a08ff3851f8eed434c3f39c027da411203..77cf5d1862e9b4f418b9e3733f767d7a6e8f2e83 100644 (file)
@@ -1314,17 +1314,16 @@ static PyMethodDef PySocket_methods[] = {
 
 /* Convenience routine to export an integer value.
  *
- * Since this function is called only from initsocket/init_socket(), any
- * errors trigger a fatal exception.
+ * Errors are silently ignored, for better or for worse...
  */
 static void
 BUILD_FUNC_DEF_3(insint,PyObject *,d, char *,name, int,value)
 {
        PyObject *v = PyInt_FromLong((long) value);
        if (!v || PyDict_SetItemString(d, name, v))
-               Py_FatalError("can't initialize socket module");
+               PyErr_Clear();
 
-       Py_DECREF(v);
+       Py_XDECREF(v);
 }
 
 
@@ -1398,15 +1397,15 @@ initsocket()
        m = Py_InitModule("socket", PySocket_methods);
 #endif
        d = PyModule_GetDict(m);
-       PySocket_Error = PyString_FromString("socket.error");
-       if (PySocket_Error == NULL || 
-           PyDict_SetItemString(d, "error", PySocket_Error) != 0)
-               Py_FatalError("can't define socket.error");
+       PySocket_Error = PyErr_NewException("socket.error", NULL, NULL);
+       if (PySocket_Error == NULL)
+               return;
+       PyDict_SetItemString(d, "error", PySocket_Error);
        PySocketSock_Type.ob_type = &PyType_Type;
        Py_INCREF(&PySocketSock_Type);
        if (PyDict_SetItemString(d, "SocketType",
                                 (PyObject *)&PySocketSock_Type) != 0)
-               Py_FatalError("can't define socket.SocketType");
+               return;
        insint(d, "AF_INET", AF_INET);
 #ifdef AF_UNIX
        insint(d, "AF_UNIX", AF_UNIX);
index a67bc33df57ebb06f087529d52d2995a97aa27cf..0403138753acc29b41e2c676c1bd0b90733ad73a 100644 (file)
@@ -2651,13 +2651,11 @@ initstdwin()
        d = PyModule_GetDict(m);
        
        /* Initialize stdwin.error exception */
-       StdwinError = PyString_FromString("stdwin.error");
+       StdwinError = PyErr_NewException("stdwin.error", NULL, NULL);
        if (StdwinError == NULL ||
            PyDict_SetItemString(d, "error", StdwinError) != 0)
-               Py_FatalError("can't define stdwin.error");
+               return;
 #ifdef WITH_THREAD
        StdwinLock = allocate_lock();
-       if (StdwinLock == NULL)
-               Py_FatalError("can't allocate stdwin lock");
 #endif
 }
index ef35bd707fb00c887125d71601252bc029cd4a84..4b01f4bc2dc4da2ccb0790589872378eb73bbe9d 100644 (file)
@@ -1298,10 +1298,8 @@ initstruct()
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
-       StructError = PyString_FromString("struct.error");
+       StructError = PyErr_NewException("struct.error", NULL, NULL);
+       if (StructError == NULL)
+               return;
        PyDict_SetItemString(d, "error", StructError);
-
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module struct");
 }
index 6155445a61a977753a1d32c2338e6567833ff3a6..d0edea62207014086e877acc24770904f3573b40 100644 (file)
@@ -508,9 +508,7 @@ initsunaudiodev()
 
        m = Py_InitModule("sunaudiodev", sunaudiodev_methods);
        d = PyModule_GetDict(m);
-       SunAudioError = PyString_FromString("sunaudiodev.error");
+       SunAudioError = PyErr_NewException("sunaudiodev.error", NULL, NULL);
        if (SunAudioError)
                PyDict_SetItemString(d, "error", SunAudioError);
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize sunaudiodev module");
 }
index bc6d13f53594dcc65302275dc4ecb8cc74a22e23..75f20238e412499c590a4dd1e6c71459efbb385a 100644 (file)
@@ -1070,7 +1070,7 @@ initsv()
        m = Py_InitModule("sv", sv_methods);
        d = PyModule_GetDict(m);
 
-       SvError = PyString_FromString("sv.error");
+       SvError = PyErr_NewException("sv.error", NULL, NULL);
        if (SvError == NULL || PyDict_SetItemString(d, "error", SvError) != 0)
-               Py_FatalError("can't define sv.error");
+               return;
 }
index 12418b5736bc3d54e5c438b0894b3b5c92ab9ec0..5e46630ab421a2f563bfd5e2173f4661c9d00cff 100644 (file)
@@ -241,9 +241,6 @@ PyInit_termios()
        m = Py_InitModule("termios", termios_methods);
 
        d = PyModule_GetDict(m);
-       TermiosError = Py_BuildValue("s", "termios.error");
+       TermiosError = PyErr_NewException("termios.error", NULL, NULL);
        PyDict_SetItemString(d, "error", TermiosError);
-
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module termios");
 }
index 49cefcc8d9061c387263fab54fe22a1952f40a6b..214263fc439603c6603e5329e7fccefc2b4d4471 100644 (file)
@@ -356,13 +356,9 @@ initthread()
 
        /* Add a symbolic constant */
        d = PyModule_GetDict(m);
-       ThreadError = PyString_FromString("thread.error");
+       ThreadError = PyErr_NewException("thread.error", NULL, NULL);
        PyDict_SetItemString(d, "error", ThreadError);
 
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module thread");
-
        /* Initialize the C thread library */
        init_thread();
 }
index 465da68676bdabe18dd8ec080a7eca94d60e2bc9..792ef3f3bb0b31db98db26d5146197f185346a8a 100644 (file)
@@ -231,10 +231,6 @@ initxx()
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
-       ErrorObject = PyString_FromString("xx.error");
+       ErrorObject = PyErr_NewException("xx.error", NULL, NULL);
        PyDict_SetItemString(d, "error", ErrorObject);
-
-       /* Check for errors */
-       if (PyErr_Occurred())
-               Py_FatalError("can't initialize module xx");
 }
index bc1b6f8d62fbcafb4e4382fde3ab6eb085aa5500..98dbfa5c5587fcc6d4a0a934a714ee6f3e321452 100644 (file)
@@ -801,7 +801,7 @@ PyInit_zlib()
                           zlib_module_documentation,
                           (PyObject*)NULL,PYTHON_API_VERSION);
         d = PyModule_GetDict(m);
-        ZlibError = Py_BuildValue("s", "zlib.error");
+        ZlibError = PyErr_NewException("zlib.error", NULL, NULL);
         PyDict_SetItemString(d, "error", ZlibError);
 
        insint(d, "MAX_WBITS", MAX_WBITS);
@@ -815,7 +815,4 @@ PyInit_zlib()
        insint(d, "Z_DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY);
        ver = PyString_FromString(ZLIB_VERSION);
        PyDict_SetItemString(d, "ZLIB_VERSION", ver);
-
-        if (PyErr_Occurred())
-                Py_FatalError("can't initialize module zlib");
 }