Issue #3313: Contrary to the man page, a failed dlopen() call does not
always set a dlerror() message.
diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c
index ccf1cb1..b2ea4f5 100644
--- a/Modules/dlmodule.c
+++ b/Modules/dlmodule.c
@@ -186,7 +186,10 @@
 	}
 	handle = dlopen(name, mode);
 	if (handle == NULL) {
-		PyErr_SetString(Dlerror, dlerror());
+		char *errmsg = dlerror();
+		if (!errmsg)
+			errmsg = "dlopen() error";
+		PyErr_SetString(Dlerror, errmsg);
 		return NULL;
 	}
 #ifdef __VMS