diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index a713679e8..ddb4ca0e0 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -4728,7 +4728,7 @@ static struct PyModuleDef moduledef = { /* Initialization function for the module */ #if defined(NPY_PY3K) -#define RETVAL m +#define RETVAL retval PyMODINIT_FUNC PyInit_multiarray(void) { #else #define RETVAL @@ -4736,6 +4736,7 @@ PyMODINIT_FUNC initmultiarray(void) { #endif PyObject *m, *d, *s; PyObject *c_api; + PyObject *retval = NULL; /* Create the module and add the functions */ #if defined(NPY_PY3K) @@ -4761,6 +4762,10 @@ PyMODINIT_FUNC initmultiarray(void) { /* Initialize access to the PyDateTime API */ numpy_pydatetime_import(); + if (PyErr_Occurred()) { + goto err; + } + /* Add some symbolic constants to the module */ d = PyModule_GetDict(m); if (!d) { @@ -4888,6 +4893,8 @@ PyMODINIT_FUNC initmultiarray(void) { if (set_typeinfo(d) != 0) { goto err; } + retval = m; + return RETVAL; err: diff --git a/numpy/core/src/umath/umathmodule.c b/numpy/core/src/umath/umathmodule.c index 1a6cee030..0706d2bad 100644 --- a/numpy/core/src/umath/umathmodule.c +++ b/numpy/core/src/umath/umathmodule.c @@ -310,7 +310,7 @@ static struct PyModuleDef moduledef = { #include #if defined(NPY_PY3K) -#define RETVAL m +#define RETVAL retval PyMODINIT_FUNC PyInit_umath(void) #else #define RETVAL @@ -318,6 +318,7 @@ PyMODINIT_FUNC initumath(void) #endif { PyObject *m, *d, *s, *s2, *c_api; + PyObject *retval = NULL; int UFUNC_FLOATING_POINT_SUPPORT = 1; #ifdef NO_UFUNC_FLOATING_POINT_SUPPORT @@ -428,6 +429,8 @@ PyMODINIT_FUNC initumath(void) goto err; } + retval = m; + return RETVAL; err: