summaryrefslogtreecommitdiff
path: root/src/if_python.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-24 15:42:14 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-24 15:42:14 +0200
commit4c3a326c53c27f67f7ce8e1bbabc684c74a06634 (patch)
treeca1b71d592f347fbd3c7f7feb94a3e72e7201fd2 /src/if_python.c
parent2a7e2a62543126d75525d861c3417ac9bb209159 (diff)
downloadvim-4c3a326c53c27f67f7ce8e1bbabc684c74a06634.zip
Temporary solution for crashing when using both :py and :py3: disallow both in
one session.
Diffstat (limited to 'src/if_python.c')
-rw-r--r--src/if_python.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/if_python.c b/src/if_python.c
index 8185fc136..95be35724 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -343,6 +343,16 @@ python_runtime_link_init(char *libname, int verbose)
{
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)
{