diff src/if_python.c @ 2384:aeea25941392 vim73

Temporary solution for crashing when using both :py and :py3: disallow both in one session.
author Bram Moolenaar <bram@vim.org>
date Sat, 24 Jul 2010 15:42:14 +0200
parents f414e5a4b40e
children 76f0c4918f5c
line wrap: on
line diff
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -343,6 +343,16 @@ python_runtime_link_init(char *libname, 
 {
     int i;
 
+#if defined(UNIX) && defined(FEAT_PYTHON3)
+    /* Can't have Python and Python3 loaded at the same time, it may cause a
+     * crash. */
+    if (python3_loaded())
+    {
+	EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
+	return FAIL;
+    }
+#endif
+
     if (hinstPython)
 	return OK;
     hinstPython = load_dll(libname);
@@ -519,6 +529,14 @@ python_end()
     --recurse;
 }
 
+#if (defined(DYNAMIC_PYTHON) && defined(FEAT_PYTHON3)) || defined(PROTO)
+    int
+python_loaded()
+{
+    return (hinstPython != 0);
+}
+#endif
+
     static int
 Python_Init(void)
 {