diff src/if_python.c @ 2554:7abef60aca22 vim73

Add a configure check for RTLD_GLOBAL. (James Vega, Roland Puntaier)
author Bram Moolenaar <bram@vim.org>
date Fri, 13 Aug 2010 16:22:57 +0200
parents 8bc2e8390c11
children fa5dee44df3f
line wrap: on
line diff
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -102,9 +102,7 @@ struct PyMethodDef { Py_ssize_t a; };
 #  include <dlfcn.h>
 #  define FARPROC void*
 #  define HINSTANCE void*
-#  ifdef FEAT_PYTHON3
-   /* Don't use RTLD_GLOBAL, it may cause a crash if both :python and :py3 are
-    * used. But without it importing may fail, e.g., for termios. */
+#  ifdef PY_NO_RTLD_GLOBAL
 #   define load_dll(n) dlopen((n), RTLD_LAZY)
 #  else
 #   define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
@@ -351,17 +349,16 @@ python_runtime_link_init(char *libname, 
 {
     int i;
 
-#if 0  /* this should be OK now that we don't use RTLD_GLOBAL */
-#if defined(UNIX) && defined(FEAT_PYTHON3)
-    /* Can't have Python and Python3 loaded at the same time, it may cause a
-     * crash. */
+#if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON3)
+    /* Can't have Python and Python3 loaded at the same time.
+     * It cause a crash, because RTLD_GLOBAL is needed for
+     * standard C extension libraries of one or both python versions. */
     if (python3_loaded())
     {
-	EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
+	EMSG(_("E836: This Vim cannot execute :python after using :py3"));
 	return FAIL;
     }
 #endif
-#endif
 
     if (hinstPython)
 	return OK;