]> granicus.if.org Git - python/commitdiff
Check return result from Py_InitModule*(). This API can fail.
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 19 Jan 2006 06:09:39 +0000 (06:09 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 19 Jan 2006 06:09:39 +0000 (06:09 +0000)
Probably should be backported.

80 files changed:
Modules/_bsddb.c
Modules/_curses_panel.c
Modules/_cursesmodule.c
Modules/_elementtree.c
Modules/_heapqmodule.c
Modules/_localemodule.c
Modules/_randommodule.c
Modules/_sre.c
Modules/_ssl.c
Modules/_testcapimodule.c
Modules/_tkinter.c
Modules/almodule.c
Modules/arraymodule.c
Modules/audioop.c
Modules/binascii.c
Modules/bsddbmodule.c
Modules/bz2module.c
Modules/cPickle.c
Modules/cStringIO.c
Modules/cdmodule.c
Modules/clmodule.c
Modules/cmathmodule.c
Modules/collectionsmodule.c
Modules/datetimemodule.c
Modules/dbmmodule.c
Modules/dlmodule.c
Modules/errnomodule.c
Modules/fcntlmodule.c
Modules/flmodule.c
Modules/fmmodule.c
Modules/fpectlmodule.c
Modules/fpetestmodule.c
Modules/functionalmodule.c
Modules/gcmodule.c
Modules/gdbmmodule.c
Modules/grpmodule.c
Modules/imageop.c
Modules/imgfile.c
Modules/itertoolsmodule.c
Modules/linuxaudiodev.c
Modules/mathmodule.c
Modules/md5module.c
Modules/mmapmodule.c
Modules/nismodule.c
Modules/operator.c
Modules/ossaudiodev.c
Modules/parsermodule.c
Modules/posixmodule.c
Modules/puremodule.c
Modules/pwdmodule.c
Modules/pyexpat.c
Modules/readline.c
Modules/regexmodule.c
Modules/resource.c
Modules/rgbimgmodule.c
Modules/selectmodule.c
Modules/sha256module.c
Modules/sha512module.c
Modules/shamodule.c
Modules/signalmodule.c
Modules/socketmodule.c
Modules/spwdmodule.c
Modules/stropmodule.c
Modules/structmodule.c
Modules/sunaudiodev.c
Modules/svmodule.c
Modules/symtablemodule.c
Modules/syslogmodule.c
Modules/termios.c
Modules/threadmodule.c
Modules/timemodule.c
Modules/xxmodule.c
Modules/zlibmodule.c
PC/_subprocess.c
PC/_winreg.c
PC/msvcrtmodule.c
PC/winsound.c
Python/import.c
Python/marshal.c
Python/sysmodule.c

index 6f4da7ee61615ebd9dc070a8cb1a31f731fb3278..aa4a1617cb5cff871ec68429d24778321eda7967 100644 (file)
@@ -5034,6 +5034,8 @@ DL_EXPORT(void) init_bsddb(void)
 
     /* Create the module and add the functions */
     m = Py_InitModule(_bsddbModuleName, bsddb_methods);
+    if (m == NULL)
+       return;
 
     /* Add some symbolic constants to the module */
     d = PyModule_GetDict(m);
index b5f30cb85efcbbe8156fef092ac3384a1e261f73..c3f313a33483d4719dec4f67a88cd99c805a63b4 100644 (file)
@@ -462,6 +462,8 @@ init_curses_panel(void)
 
     /* Create the module and add the functions */
     m = Py_InitModule("_curses_panel", PyCurses_methods);
+    if (m == NULL)
+       return;
     d = PyModule_GetDict(m);
 
     /* For exception _curses_panel.error */
index 176f024d29365870d23cb4dba63e9ae0845656aa..4c03602d5652cccf8648d2f95517d39061d0d187 100644 (file)
@@ -2481,6 +2481,8 @@ init_curses(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule("_curses", PyCurses_methods);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index 641f2728e0b35ebbc66dcf1899f4ee1bf314e4d3..ea5aa6cf08a2f8783f876769558325817ee9c4ef 100644 (file)
@@ -2590,6 +2590,8 @@ init_elementtree(void)
 #endif
 
     m = Py_InitModule("_elementtree", _functions);
+    if (m == NULL)
+       return;
 
     /* python glue code */
 
index 5a78c453e19e5f378d1ce939626cc0b03fd83a0c..999647e11a100736afe15ce0309139b4cc70bb03 100644 (file)
@@ -610,6 +610,8 @@ init_heapq(void)
        PyObject *m;
 
        m = Py_InitModule3("_heapq", heapq_methods, module_doc);
+       if (m == NULL)
+               return;
        PyModule_AddObject(m, "__about__", PyString_FromString(__about__));
 }
 
index bd57c2ff94986b69d7d4b5a97423171a3556fba4..2d84d80ae7cdc0cdee99f2ac621a95aa9b6fad78 100644 (file)
@@ -715,6 +715,8 @@ init_locale(void)
 #endif
 
     m = Py_InitModule("_locale", PyLocale_Methods);
+    if (m == NULL)
+       return;
 
     d = PyModule_GetDict(m);
 
index 8fe2b2bc999fe2be9b180d4363d180d9a66f6f89..bd1c9d39b1b7d26d5e93fd89586df7961b4ef788 100644 (file)
@@ -573,6 +573,8 @@ init_random(void)
        if (PyType_Ready(&Random_Type) < 0)
                return;
        m = Py_InitModule3("_random", NULL, module_doc);
+       if (m == NULL)
+               return;
        Py_INCREF(&Random_Type);
        PyModule_AddObject(m, "Random", (PyObject *)&Random_Type);
 }
index 1f0a8bc9394c6eee3480ec6858f405b18c25d8a5..4d9d1cd773fda4be6401aa33b3d96824f7f9a41a 100644 (file)
@@ -3389,6 +3389,8 @@ PyMODINIT_FUNC init_sre(void)
         Scanner_Type.ob_type = &PyType_Type;
 
     m = Py_InitModule("_" SRE_MODULE, _functions);
+    if (m == NULL)
+       return;
     d = PyModule_GetDict(m);
 
     x = PyInt_FromLong(SRE_MAGIC);
index 9c100abfcdf7ea627316563cddee55ef5bb1fb3f..fd5e2c629555c4b6c53bcbc64df0e2094356bfbd 100644 (file)
@@ -634,6 +634,8 @@ init_ssl(void)
        PySSL_Type.ob_type = &PyType_Type;
 
        m = Py_InitModule3("_ssl", PySSL_methods, module_doc);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        /* Load _socket module and its C API */
index 9a5d885434537cf810d78477667fd2c0468f345b..c008b874b3ab42a294480685e335efe371beec70 100644 (file)
@@ -627,6 +627,8 @@ init_testcapi(void)
        PyObject *m;
 
        m = Py_InitModule("_testcapi", TestMethods);
+       if (m == NULL)
+               return;
 
        PyModule_AddObject(m, "UCHAR_MAX", PyInt_FromLong(UCHAR_MAX));
        PyModule_AddObject(m, "USHRT_MAX", PyInt_FromLong(USHRT_MAX));
index c3015b9f8a5388b7c1d731b7acf9dbf6b8b3345e..70cd670b126f9266d5dba20e157e41187f102b9c 100644 (file)
@@ -3088,6 +3088,8 @@ init_tkinter(void)
 #endif
 
        m = Py_InitModule("_tkinter", moduleMethods);
+       if (m == NULL)
+               return;
 
        d = PyModule_GetDict(m);
        Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
index 12b265e90ece7d82998e328074a12902ed016171..5254fca18eb4b25cfc8c220f964f75ec4e441a2a 100644 (file)
@@ -1996,6 +1996,8 @@ inital(void)
        m = Py_InitModule4("al", al_methods,
                al_module_documentation,
                (PyObject*)NULL,PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index 3c603506732778bb056f056f1ec1c7468fce6867..4c7cdf2197814281744a07b828ec3b678fc60f0a 100644 (file)
@@ -2118,6 +2118,8 @@ initarray(void)
        Arraytype.ob_type = &PyType_Type;
        PyArrayIter_Type.ob_type = &PyType_Type;
        m = Py_InitModule3("array", a_methods, module_doc);
+       if (m == NULL)
+               return;
 
         Py_INCREF((PyObject *)&Arraytype);
        PyModule_AddObject(m, "ArrayType", (PyObject *)&Arraytype);
index 52824b84b6943adc7db6909a70086c686765854d..8d5a3055250cdaabfb374cc1a0551918910a1dba 100644 (file)
@@ -1374,6 +1374,8 @@ initaudioop(void)
 {
        PyObject *m, *d;
        m = Py_InitModule("audioop", audioop_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        AudioopError = PyErr_NewException("audioop.error", NULL, NULL);
        if (AudioopError != NULL)
index eab90b3b7451044e499340e48ab125a2da5dfccc..4a2c268f2b9170af378eda9939063ba9926ba550 100644 (file)
@@ -1335,6 +1335,8 @@ initbinascii(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule("binascii", binascii_module_methods);
+       if (m == NULL)
+               return;
 
        d = PyModule_GetDict(m);
        x = PyString_FromString(doc_binascii);
index ac8c44395f7ebe197baece010d349603e49b6126..6bdffde7b2a3b55ddee561c3d96a43c7dfc8a6c8 100644 (file)
@@ -849,6 +849,8 @@ initbsddb185(void) {
 
        Bsddbtype.ob_type = &PyType_Type;
        m = Py_InitModule("bsddb185", bsddbmodule_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        BsddbError = PyErr_NewException("bsddb.error", NULL, NULL);
        if (BsddbError != NULL)
index 82b3958b8f9ffaa9895331233a6ff6598e166dbf..9f30f8a9885d5ee04b51b1606cab7a88d798fcf2 100644 (file)
@@ -2192,6 +2192,8 @@ initbz2(void)
        BZ2Decomp_Type.ob_type = &PyType_Type;
 
        m = Py_InitModule3("bz2", bz2_methods, bz2__doc__);
+       if (m == NULL)
+               return;
 
        PyModule_AddObject(m, "__author__", PyString_FromString(__author__));
 
index 865541ff5c7b49f0315b2dbb2ad88daf3d2c1b9d..cc821fdf464a4a377cfaa271e0ba460cbf06d873 100644 (file)
@@ -5730,6 +5730,8 @@ initcPickle(void)
        m = Py_InitModule4("cPickle", cPickle_methods,
                           cPickle_module_documentation,
                           (PyObject*)NULL,PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index 0d50459166b1ebb6ec8f550e737026e3f796c440..ad2f36b9b399eba3b1aa781e901b72352fe79d71 100644 (file)
@@ -716,6 +716,7 @@ initcStringIO(void) {
   m = Py_InitModule4("cStringIO", IO_methods,
                     cStringIO_module_documentation,
                     (PyObject*)NULL,PYTHON_API_VERSION);
+  if (m == NULL) return;
 
   /* Add some symbolic constants to the module */
   d = PyModule_GetDict(m);
index 25add3e1b61337e9d1fa4f13100e5b1a3237ce18..f8efd395a19af167795d5749dfdbc2a8d3805798 100644 (file)
@@ -760,6 +760,8 @@ initcd(void)
        PyObject *m, *d;
 
        m = Py_InitModule("cd", CD_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        CdError = PyErr_NewException("cd.error", NULL, NULL);
index 70e8f8e7d9a68b04285b90223e326da820c4dc1f..a535e031f530ae92f73445918d73e65386310658 100644 (file)
@@ -963,6 +963,8 @@ initcl(void)
        PyObject *m, *d, *x;
 
        m = Py_InitModule("cl", cl_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        ClError = PyErr_NewException("cl.error", NULL, NULL);
index 78b9dd5f8fad55ec2122e3239bd56fdbcd3547f9..ec48ce8d7254017eac2f3207cba8aaf8c8092a96 100644 (file)
@@ -417,6 +417,8 @@ initcmath(void)
        PyObject *m;
 
        m = Py_InitModule3("cmath", cmath_methods, module_doc);
+       if (m == NULL)
+               return;
 
        PyModule_AddObject(m, "pi",
                            PyFloat_FromDouble(atan(1.0) * 4.0));
index 1a8258ef7c3f00baefe5251c370daec8b2b0062c..16f25dfaae00ccdb5e974ee8ada43633087b73fc 100644 (file)
@@ -1077,6 +1077,8 @@ initcollections(void)
        PyObject *m;
 
        m = Py_InitModule3("collections", NULL, module_doc);
+       if (m == NULL)
+               return;
 
        if (PyType_Ready(&deque_type) < 0)
                return;
index 8a6fae2bc198a0cca2fd7faa4ab7358e868cb855..50f47d45f46b129ca356adee5a6197ff6e2ce83d 100644 (file)
@@ -4615,6 +4615,8 @@ initdatetime(void)
 
        m = Py_InitModule3("datetime", module_methods,
                           "Fast implementation of the datetime type.");
+       if (m == NULL)
+               return;
 
        if (PyType_Ready(&PyDateTime_DateType) < 0)
                return;
index 40d06fc26803463d9a1d1aa67b6867715adec060..cc963a2dfd87e4492adc0e070470c9d794d4267a 100644 (file)
@@ -359,6 +359,8 @@ initdbm(void) {
 
        Dbmtype.ob_type = &PyType_Type;
        m = Py_InitModule("dbm", dbmmodule_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        if (DbmError == NULL)
                DbmError = PyErr_NewException("dbm.error", NULL, NULL);
index 927f4c0ac8287e77540c0a1068da4f1fff2353d3..09556814f2dc779e7e397ca1745416c7de0f1847 100644 (file)
@@ -219,6 +219,8 @@ initdl(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule("dl", dl_methods);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index e9c0990c28e06d388c3250aace90ff4de08bb291..696d396b07ad8dcae16a9de979e339eee8963e1e 100644 (file)
@@ -57,6 +57,8 @@ initerrno(void)
 {
        PyObject *m, *d, *de;
        m = Py_InitModule3("errno", errno_methods, errno__doc__);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        de = PyDict_New();
        if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0)
index 624019dfa52a2c22bf6ce0a9130d74789e1cb1e5..4197339e2f18edc8b9d1b9e4b3988e95f438cb16 100644 (file)
@@ -583,6 +583,8 @@ initfcntl(void)
 
        /* Create the module and add the functions and documentation */
        m = Py_InitModule3("fcntl", fcntl_methods, module_doc);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index 1ae2dc85bbd260b4d24f806792a371bac2530dc1..aa0d04e4059b83c9a95394200b3af9f4ff8ed9c0 100644 (file)
@@ -2130,6 +2130,8 @@ PyMODINIT_FUNC
 initfl(void)
 {
        Py_InitModule("fl", forms_methods);
+       if (m == NULL)
+               return;
        foreground();
        fl_init();
 }
index 78a58772c2ac0f7bcba411ee4dfdad98ff96610c..01753909111262070854850af980364038b44758 100644 (file)
@@ -258,5 +258,7 @@ void
 initfm(void)
 {
        Py_InitModule("fm", fm_methods);
+       if (m == NULL)
+               return;
        fminit();
 }
index 241c1c2620fd0f44e7953d3caa8cdbc83c935a91..c6d4f77c2312566b76f06d417b8da60ebf99f36d 100644 (file)
@@ -265,6 +265,8 @@ PyMODINIT_FUNC initfpectl(void)
 {
     PyObject *m, *d;
     m = Py_InitModule("fpectl", fpectl_methods);
+    if (m == NULL)
+       return;
     d = PyModule_GetDict(m);
     fpe_error = PyErr_NewException("fpectl.error", NULL, NULL);
     if (fpe_error != NULL)
index aa14dd82a6b294819521cf530cecb1335c4b118e..22e95dbaef1f37d197b1c5746b16bad6051b7b28 100644 (file)
@@ -177,6 +177,8 @@ PyMODINIT_FUNC initfpetest(void)
     PyObject *m, *d;
 
     m = Py_InitModule("fpetest", fpetest_methods);
+    if (m == NULL)
+       return;
     d = PyModule_GetDict(m);
     fpe_error = PyErr_NewException("fpetest.error", NULL, NULL);
     if (fpe_error != NULL)
index 95ffd5dde9cc2928ef81a09f8cf9093bb4583472..58b07d9e19e3a8c85d9d1db3f9e8cda6af4601d8 100644 (file)
@@ -263,6 +263,8 @@ initfunctional(void)
        };
 
        m = Py_InitModule3("functional", module_methods, module_doc);
+       if (m == NULL)
+               return;
 
        for (i=0 ; typelist[i] != NULL ; i++) {
                if (PyType_Ready(typelist[i]) < 0)
index db9dd3268c9a5ca23f104a149557d9722049e163..00239bd0c4b53bc76e394c01ac2d56a85cc44fef 100644 (file)
@@ -1158,6 +1158,8 @@ initgc(void)
                              gc__doc__,
                              NULL,
                              PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        if (garbage == NULL) {
                garbage = PyList_New(0);
index 03e664d6bc30cb60dea16bb93f6f3b46b6f89802..6045743df3d882466db7ce474080f78a42f1daad 100644 (file)
@@ -512,6 +512,8 @@ initgdbm(void) {
     m = Py_InitModule4("gdbm", dbmmodule_methods,
                        gdbmmodule__doc__, (PyObject *)NULL,
                        PYTHON_API_VERSION);
+    if (m == NULL)
+       return;
     d = PyModule_GetDict(m);
     DbmError = PyErr_NewException("gdbm.error", NULL, NULL);
     if (DbmError != NULL) {
index 5f33fe972fc8f33213d7132296209f85d04e2a01..de849c98bd5a2506f52876c1fc237be438cb11b7 100644 (file)
@@ -171,6 +171,8 @@ initgrp(void)
 {
     PyObject *m, *d;
     m = Py_InitModule3("grp", grp_methods, grp__doc__);
+    if (m == NULL)
+        return;
     d = PyModule_GetDict(m);
     PyStructSequence_InitType(&StructGrpType, &struct_group_type_desc);
     PyDict_SetItemString(d, "struct_group", (PyObject *) &StructGrpType);
index 5b87898bbbfd686e29fdf1e763f5769e84105e2e..92f805a83b62f338d39019bf5489ee1a3ceccb58 100644 (file)
@@ -776,6 +776,8 @@ initimageop(void)
 {
        PyObject *m;
        m = Py_InitModule("imageop", imageop_methods);
+       if (m == NULL)
+               return;
        ImageopDict = PyModule_GetDict(m);
        ImageopError = PyErr_NewException("imageop.error", NULL, NULL);
        if (ImageopError != NULL)
index f9fa25bc4ebbc78098229add6c8c819b8e34495e..bb85a78d5c295d761191757b8c202a835933ffb6 100644 (file)
@@ -492,6 +492,8 @@ initimgfile(void)
 {
        PyObject *m, *d;
        m = Py_InitModule("imgfile", imgfile_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        ImgfileError = PyErr_NewException("imgfile.error", NULL, NULL);
        if (ImgfileError != NULL)
index c675bf4b30ed44cab3872794da66195ec31a4168..a7ecf93e9b23be1f8a4bac597c2e6f1ec6bbc7f5 100644 (file)
@@ -2460,6 +2460,8 @@ inititertools(void)
 
        teedataobject_type.ob_type = &PyType_Type;
        m = Py_InitModule3("itertools", module_methods, module_doc);
+       if (m == NULL)
+               return;
 
        for (i=0 ; typelist[i] != NULL ; i++) {
                if (PyType_Ready(typelist[i]) < 0)
index a5ff367bfef7784497d58b87e4d2f2cce76d1f81..f6d5b7d44b02223add9cfa7208b575e53ca62e4b 100644 (file)
@@ -491,6 +491,8 @@ initlinuxaudiodev(void)
     PyObject *m;
   
     m = Py_InitModule("linuxaudiodev", linuxaudiodev_methods);
+    if (m == NULL)
+       return;
 
     LinuxAudioError = PyErr_NewException("linuxaudiodev.error", NULL, NULL);
     if (LinuxAudioError)
index a5fec158d245b62fe9aa52432fd9ee9399a62098..e7fc6dd709a7c6d334e52c007a9a631c22c5a737 100644 (file)
@@ -355,6 +355,8 @@ initmath(void)
        PyObject *m, *d, *v;
 
        m = Py_InitModule3("math", math_methods, module_doc);
+       if (m == NULL)
+               goto finally;
        d = PyModule_GetDict(m);
 
         if (!(v = PyFloat_FromDouble(atan(1.0) * 4.0)))
index 9c647c5e13a4bc488dd9e67b5688dbfddd34ce4a..e12bef86363b510d4a6552adc439a42bd4d9c8b3 100644 (file)
@@ -303,6 +303,8 @@ init_md5(void)
         if (PyType_Ready(&MD5type) < 0)
             return;
        m = Py_InitModule3("_md5", md5_functions, module_doc);
+       if (m == NULL)
+           return;
        d = PyModule_GetDict(m);
        PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type);
        PyModule_AddIntConstant(m, "digest_size", 16);
index 2ff4494304198c9b64e881964a340074d2bac9bf..1cd7d1709c8dbe878e1915187b354f43545ec463 100644 (file)
@@ -1092,6 +1092,8 @@ PyMODINIT_FUNC
        mmap_object_type.ob_type = &PyType_Type;
 
        module = Py_InitModule ("mmap", mmap_functions);
+       if (module == NULL)
+               return;
        dict = PyModule_GetDict (module);
        mmap_module_error = PyExc_EnvironmentError;
        Py_INCREF(mmap_module_error);
index 2494adbbedad622d2ca7c5f96fc1cbfa553c8025..207f7b8e7e52cb804c5f0318ddad8596751d816f 100644 (file)
@@ -379,6 +379,8 @@ initnis (void)
 {
        PyObject *m, *d;
        m = Py_InitModule("nis", nis_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        NisError = PyErr_NewException("nis.error", NULL, NULL);
        if (NisError != NULL)
index ddd0252931f7ab1d35e47f39aeb81c1b414cfb59..4817d3389cb0a005fc3442a2109842277cc79cb3 100644 (file)
@@ -578,6 +578,8 @@ initoperator(void)
        /* Create the module and add the functions */
         m = Py_InitModule4("operator", operator_methods, operator_doc,
                       (PyObject*)NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        if (PyType_Ready(&itemgetter_type) < 0)
                return;
index af3002dd3ad049022c4d86c6455ed940a433f415..4c22b07fd866ecbdde707152467b23c1261e561d 100644 (file)
@@ -963,6 +963,8 @@ initossaudiodev(void)
     PyObject *m;
 
     m = Py_InitModule("ossaudiodev", ossaudiodev_methods);
+    if (m == NULL)
+       return;
 
     OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError",
                                       NULL, NULL);
index e788fc930fee8fc943a57c7aa5a89178c37f8d75..b2b32df5498f12daf2daabb9e50b9f4762855533 100644 (file)
@@ -3148,6 +3148,8 @@ initparser(void)
 
     PyST_Type.ob_type = &PyType_Type;
     module = Py_InitModule("parser", parser_functions);
+    if (module == NULL)
+       return;
 
     if (parser_error == 0)
         parser_error = PyErr_NewException("parser.ParserError", NULL, NULL);
index b7835736856c2c76e4fc7db246a41c2fb44e47bf..100dfcfc9529bbabde4090d30689b2884e614c24 100644 (file)
@@ -7967,6 +7967,8 @@ INITFUNC(void)
        m = Py_InitModule3(MODNAME,
                           posix_methods,
                           posix__doc__);
+       if (m == NULL)
+               return;
 
        /* Initialize environ dictionary */
        v = convertenviron();
index 43c64414cb1cfc7335b9f517cae02b8b98d05cad..95f4bdecdbc4d5b676d47cddb71e6d6f4d5396d6 100644 (file)
@@ -952,6 +952,8 @@ initpure()
        PyObject *m, *d;
 
        m = Py_InitModule("pure", pure_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
         /* this is bogus because we should be able to find this information
index f418e43c9a858c9f01532f6903f9e5e010a4f9b9..9e7b864b75a045cbccc69ed76160cb04dac9882c 100644 (file)
@@ -183,6 +183,8 @@ initpwd(void)
 {
        PyObject *m;
        m = Py_InitModule3("pwd", pwd_methods, pwd__doc__);
+       if (m == NULL)
+               return;
 
        PyStructSequence_InitType(&StructPwdType, &struct_pwd_type_desc);
        Py_INCREF((PyObject *) &StructPwdType);
index c827581b1d198663e8d598174b748ff14d376a2b..76b7cf9ba0f0bc2898830c94530a7629534e3e57 100644 (file)
@@ -1854,6 +1854,8 @@ MODULE_INITFUNC(void)
     /* Create the module and add the functions */
     m = Py_InitModule3(MODULE_NAME, pyexpat_methods,
                        pyexpat_module_documentation);
+    if (m == NULL)
+       return;
 
     /* Add some symbolic constants to the module */
     if (ErrorObject == NULL) {
index f039f1aaf6d2383ee000eaacbd8458a2382b8b1d..8fda2281339af121643c6e2c313ebdd562b3aa82 100644 (file)
@@ -925,6 +925,8 @@ initreadline(void)
 
        m = Py_InitModule4("readline", readline_methods, doc_module,
                           (PyObject *)NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        PyOS_ReadlineFunctionPointer = call_readline;
        setup_readline();
index 9f84032e4d46377c453bf3edc6ce1a2baeb3227c..d44993262ea6b67163504300a4caf3b3111bfe4a 100644 (file)
@@ -653,6 +653,8 @@ initregex(void)
        Regextype.ob_type = &PyType_Type;
 
        m = Py_InitModule("regex", regex_global_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        if (PyErr_Warn(PyExc_DeprecationWarning,
index c5bec79043d25d3a7955e78a7e7f51cd8f1ed73f..7cbd2c94b490c50561fc9db2d18986c2225115a8 100644 (file)
@@ -234,6 +234,8 @@ initresource(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule("resource", resource_methods);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        if (ResourceError == NULL) {
index 904c64b642ec2fdec4e0ad12bc36ab58e8f82f37..8c70d95e74ff8d82ab3590652369a05f6618646f 100644 (file)
@@ -756,6 +756,8 @@ initrgbimg(void)
 {
        PyObject *m, *d;
        m = Py_InitModule("rgbimg", rgbimg_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        ImgfileError = PyErr_NewException("rgbimg.error", NULL, NULL);
        if (ImgfileError != NULL)
index ed2ea8197c5a934040c2747b6e77d2b99c3d6870..53c68c1a55983959c6019098ce132537153a6002 100644 (file)
@@ -662,6 +662,8 @@ initselect(void)
 {
        PyObject *m;
        m = Py_InitModule3("select", select_methods, module_doc);
+       if (m == NULL)
+               return;
 
        SelectError = PyErr_NewException("select.error", NULL, NULL);
        Py_INCREF(SelectError);
index b40bb703226d809898ad40e5222535045190eef5..e16338dc9e3ec76bd4da5511005706bd126a1073 100644 (file)
@@ -706,4 +706,6 @@ init_sha256(void)
     if (PyType_Ready(&SHA256type) < 0)
         return;
     m = Py_InitModule("_sha256", SHA_functions);
+    if (m == NULL)
+       return;
 }
index 44ed7a7764a54284e33f71f1d1e6234fa15b0dd3..3837795964fa9b9c46532b88d695a75efaf42a8b 100644 (file)
@@ -772,6 +772,8 @@ init_sha512(void)
     if (PyType_Ready(&SHA512type) < 0)
         return;
     m = Py_InitModule("_sha512", SHA_functions);
+    if (m == NULL)
+       return;
 }
 
 #endif
index 1de61c40f5f6d7784f381cd89450d3fe8792a0dd..058391d565f61e543b521d690a95dc1bd0d5cf98 100644 (file)
@@ -590,6 +590,8 @@ init_sha(void)
     if (PyType_Ready(&SHAtype) < 0)
         return;
     m = Py_InitModule("_sha", SHA_functions);
+    if (m == NULL)
+       return;
 
     /* Add some symbolic constants to the module */
     insint("blocksize", 1);  /* For future use, in case some hash
index bec27293e9e6bc9ce5f64d00681a0162a8a8cec9..a729604a316bf4cb27376d880e54b12e32518c56 100644 (file)
@@ -317,6 +317,8 @@ initsignal(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule3("signal", signal_methods, module_doc);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        d = PyModule_GetDict(m);
index b88703c7dadd8a938819e5f9bc8f0893d34c8259..cdefc58d7870cea64aa428d8744c28921a92005b 100644 (file)
@@ -3871,6 +3871,8 @@ init_socket(void)
        m = Py_InitModule3(PySocket_MODULE_NAME,
                           socket_methods,
                           socket_doc);
+       if (m == NULL)
+               return;
 
        socket_error = PyErr_NewException("socket.error", NULL, NULL);
        if (socket_error == NULL)
index 36dd2286837b451b436c2c68dc6d2a1c4639deeb..7c618e77615bab45b01462bfa7dd7ed9b50fa89c 100644 (file)
@@ -171,6 +171,8 @@ initspwd(void)
 {
        PyObject *m;
        m=Py_InitModule3("spwd", spwd_methods, spwd__doc__);
+       if (m == NULL)
+               return;
        PyStructSequence_InitType(&StructSpwdType, &struct_spwd_type_desc);
        Py_INCREF((PyObject *) &StructSpwdType);
        PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType);
index ed72a7163b231a715cd566d4a41f777d897057eb..29172987d5049b6c146e58cd6314f03a649ce6ed 100644 (file)
@@ -1210,6 +1210,8 @@ initstrop(void)
        int c, n;
        m = Py_InitModule4("strop", strop_methods, strop_module__doc__,
                           (PyObject*)NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        /* Create 'whitespace' object */
        n = 0;
index 137b8988e041c7ad1db5ce67efae0cbfabf392f1..f07f21a30cc8c07ef4cddefc15ab6ed55b0c333d 100644 (file)
@@ -1278,6 +1278,8 @@ initstruct(void)
        /* Create the module and add the functions */
        m = Py_InitModule4("struct", struct_methods, struct__doc__,
                           (PyObject*)NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        if (StructError == NULL) {
index 3269c761d64f17a8e18899c354404aa8864d24a9..802184d0d6fe8789bac06c1041495a0c99d4a2b5 100644 (file)
@@ -456,6 +456,8 @@ initsunaudiodev(void)
        PyObject *m, *d;
 
        m = Py_InitModule("sunaudiodev", sunaudiodev_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        SunAudioError = PyErr_NewException("sunaudiodev.error", NULL, NULL);
        if (SunAudioError)
index 9bd79686c4ecac59b9a83995c9c1bb48e32c4682..fb58f19cc3517b09fd9db7b1faa3666c25223e8d 100644 (file)
@@ -956,6 +956,8 @@ initsv(void)
        PyObject *m, *d;
 
        m = Py_InitModule("sv", sv_methods);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        SvError = PyErr_NewException("sv.error", NULL, NULL);
index 7a52aae0e6e9ab30d6bd7d9f9d07d7bf5a142756..c90d7650a16362d82cbf5f5c169d3307520bde34 100644 (file)
@@ -53,6 +53,8 @@ init_symtable(void)
        PyObject *m;
 
        m = Py_InitModule("_symtable", symtable_methods);
+       if (m == NULL)
+               return;
        PyModule_AddIntConstant(m, "USE", USE);
        PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL);
        PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL);
index 1f2b874fdbe0f92db408a750fb0667725b6fe741..dd35923139a99228736c755af1707c8cff79a834 100644 (file)
@@ -163,6 +163,8 @@ initsyslog(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule("syslog", syslog_methods);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
 
index a1d14a18b845b0ef8be655c6675e5472cc867413..c53566c12b70524941dea6ec1fe7a145c7703573 100644 (file)
@@ -910,6 +910,8 @@ PyInit_termios(void)
 
        m = Py_InitModule4("termios", termios_methods, termios__doc__,
                            (PyObject *)NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               return;
 
        if (TermiosError == NULL) {
                TermiosError = PyErr_NewException("termios.error", NULL, NULL);
index 3025595df1b2a8f91afaec6abe15bab100e80086..fccdd6264495ed088c5b58bdb396118d1786f7ee 100644 (file)
@@ -638,6 +638,8 @@ initthread(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule3("thread", thread_methods, thread_doc);
+       if (m == NULL)
+               return;
 
        /* Add a symbolic constant */
        d = PyModule_GetDict(m);
index 2cd9a571f3dc1eab35d69fc75ddd495abd460585..ba93957b8856c2b86b0f6d8630c2861c178a211b 100644 (file)
@@ -785,6 +785,8 @@ inittime(void)
        PyObject *m;
        char *p;
        m = Py_InitModule3("time", time_methods, module_doc);
+       if (m == NULL)
+               return;
 
        /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
        p = Py_GETENV("PYTHONY2K");
index 5f75b6cf8f9de6d6064b67f4ac9fd5ff8d10ffd0..ea66eefa0a6829f0755021b76c7e2031289e5eda 100644 (file)
@@ -352,6 +352,8 @@ initxx(void)
 
        /* Create the module and add the functions */
        m = Py_InitModule3("xx", xx_methods, module_doc);
+       if (m == NULL)
+               return;
 
        /* Add some symbolic constants to the module */
        if (ErrorObject == NULL) {
index a598ae31c31fe6e75feda2e4a23dd6961e6c9106..725755d10563bec49866ba7e95b69c8906f563d0 100644 (file)
@@ -878,6 +878,8 @@ PyInit_zlib(void)
     m = Py_InitModule4("zlib", zlib_methods,
                       zlib_module_documentation,
                       (PyObject*)NULL,PYTHON_API_VERSION);
+    if (m == NULL)
+       return;
 
     ZlibError = PyErr_NewException("zlib.error", NULL, NULL);
     if (ZlibError != NULL) {
index 8ed4899d8cbeac819a88013e3b923dcc9f6a7c13..b675b88462e80891db7f653eb167e4288469153d 100644 (file)
@@ -553,6 +553,8 @@ init_subprocess()
        sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int;
 
        m = Py_InitModule("_subprocess", sp_functions);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
 
        /* constants */
index 34e4f6895a881bdca4f5d20c5fa8ecf974bd11a7..965acf1e180f85e8e6f6def71642076f6dc87d4f 100644 (file)
@@ -1459,6 +1459,8 @@ PyMODINIT_FUNC init_winreg(void)
 {
        PyObject *m, *d;
        m = Py_InitModule3("_winreg", winreg_methods, module_doc);
+       if (m == NULL)
+               return;
        d = PyModule_GetDict(m);
        PyHKEY_Type.ob_type = &PyType_Type;
        PyHKEY_Type.tp_doc = PyHKEY_doc;
index 84cf0c132ea344e40e7d2d6c0676633f1e37106f..4453023a6a8acd95d26117a78e006db06511c772 100755 (executable)
@@ -221,6 +221,8 @@ PyMODINIT_FUNC
 initmsvcrt(void)
 {
        PyObject *m = Py_InitModule("msvcrt", msvcrt_functions);
+       if (m == NULL)
+               return;
        PyObject *d = PyModule_GetDict(m);
 
        /* constants for the locking() function's mode argument */
index b94b32206860576afc37a5f17195a8d4db4326ff..81e3917ed66dcf2d328dda9c7b8dd577b655103b 100644 (file)
@@ -220,6 +220,8 @@ initwinsound(void)
        PyObject *module = Py_InitModule3("winsound",
                                          sound_methods,
                                          sound_module_doc);
+       if (module == NULL)
+               return;
        PyObject *dict = PyModule_GetDict(module);
 
        ADD_DEFINE(SND_ASYNC);
index f284ff4d21186cbc136034d0adae4fb1045b0b31..8bd25f7764db75ba557aa785d0c65324687bc96d 100644 (file)
@@ -2817,6 +2817,8 @@ initimp(void)
 
        m = Py_InitModule4("imp", imp_methods, doc_imp,
                           NULL, PYTHON_API_VERSION);
+       if (m == NULL)
+               goto failure;
        d = PyModule_GetDict(m);
 
        if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure;
index ff8247c9f232cc176328d93bb37f94a0ea9deb1c..56172267870c40f8cc7916a2d7b5009f76382a15 100644 (file)
@@ -1107,5 +1107,7 @@ PyMODINIT_FUNC
 PyMarshal_Init(void)
 {
        PyObject *mod = Py_InitModule("marshal", marshal_methods);
+       if (mod == NULL)
+               return;
        PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION);
 }
index 5bbe9502242ab964f91cd09503a590c8b0bd75ef..f793b99348a5d90bbc49423458f7d0caceed49d3 100644 (file)
@@ -1027,6 +1027,8 @@ _PySys_Init(void)
 #endif
 
        m = Py_InitModule3("sys", sys_methods, sys_doc);
+       if (m == NULL)
+               return NULL;
        sysdict = PyModule_GetDict(m);
 
        {