diff Python/import.c @ 1353:a6355c83578d legacy-trunk

* stdwinmodule.c (stdwin_done): interface to shutdown stdwin (now this is no longer done by config.c). * stdwinmodule.c (initstdwin), config.c (initall): get command line arguments from sys.argv instead of special-casing stdwin in config.c * import.c (get_module): fix core dump when foomodule.o does not define initfoo(). * ChangeLog: documented changes by Sjoerd.
author Guido van Rossum <guido@python.org>
date Mon, 18 Oct 1993 11:44:47 +0000
parents e149c77d173c
children 1808ca5d8883
line wrap: on
line diff
--- a/Python/import.c	Fri Oct 15 16:18:48 1993 +0000
+++ b/Python/import.c	Mon Oct 18 11:44:47 1993 +0000
@@ -191,20 +191,22 @@
 		  p = (dl_funcptr) dlsym(handle, funcname);
 		}
 #else
+		if (verbose)
+			fprintf(stderr,
+				"import %s # dynamically loaded from \"%s\"\n",
+				name, namebuf);
 		p =  dl_loadmod(argv0, namebuf, funcname);
 #endif /* SUN_SHLIB */
 		if (p == NULL) {
-			D(fprintf(stderr, "dl_loadmod failed\n"));
+			err_setstr(SystemError,
+			   "dynamic module does not define init function");
+			return NULL;
 		} else {
-			if (verbose)
-				fprintf(stderr,
-			"import %s # dynamically loaded from \"%s\"\n",
-					name, namebuf);
 			(*p)();
 			*m_ret = m = dictlookup(modules, name);
 			if (m == NULL) {
 				err_setstr(SystemError,
-					   "dynamic module missing");
+				   "dynamic module not initialized properly");
 				return NULL;
 			} else {
 				D(fprintf(stderr,