Source

pygame / src / _numericsndarray.c

Diff from to

src/_numericsndarray.c

 */
 
 #include "pygame.h"
-#include "pygamedocs.h"
+#include "doc/sndarray_doc.h"
 #include "mixer.h"
 #include "numeric_arrayobject.h"
 #include <SDL_byteorder.h>
 PYGAME_EXPORT
 void init_numericsndarray (void)
 {
-    PyObject *module, *dict;
-    PyObject *numeric_module;
-    
-    numeric_module = PyImport_ImportModule ("Numeric");
-    if (numeric_module != 0)
-    {
-	/* create the module */
-	module = Py_InitModule3 ("_numericsndarray", sndarray_builtins,
-				 DOC_PYGAMESNDARRAY);
-	dict = PyModule_GetDict (module);
-        
-	/*imported needed apis*/
-	import_pygame_base ();
-	import_pygame_mixer ();
-	import_array ();
+    /* imported needed apis; Do this first so if there is an error
+       the module is not loaded.
+    */
+    import_pygame_base ();
+    if (PyErr_Occurred ()) {
+	return;
     }
+    import_pygame_mixer ();
+    if (PyErr_Occurred ()) {
+	return;
+    }
+    import_array ();
+    if (PyErr_Occurred ()) {
+	return;
+    }
+
+    /* create the module */
+    Py_InitModule3 ("_numericsndarray", sndarray_builtins, DOC_PYGAMESNDARRAY);
 }