Skip to content

Commit dcafb48

Browse files
committed
Merge pull request #164 from macvim-dev/fix/pythonhome_workaround
WORKAROUND: Allow to honor PYTHONHOME environment variable for +python/dyn and +python3/dyn
2 parents d8ddc5d + e73d89f commit dcafb48

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/if_python.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,10 @@ Python_Init(void)
932932
#endif
933933

934934
#ifdef PYTHON_HOME
935-
Py_SetPythonHome(PYTHON_HOME);
935+
# ifdef DYNAMIC_PYTHON
936+
if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
937+
# endif
938+
Py_SetPythonHome(PYTHON_HOME);
936939
#endif
937940

938941
init_structs();

src/if_python3.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,10 @@ Python3_Init(void)
858858

859859

860860
#ifdef PYTHON3_HOME
861-
Py_SetPythonHome(PYTHON3_HOME);
861+
# ifdef DYNAMIC_PYTHON3
862+
if (mch_getenv((char_u *)"PYTHONHOME") == NULL)
863+
# endif
864+
Py_SetPythonHome(PYTHON3_HOME);
862865
#endif
863866

864867
PyImport_AppendInittab("vim", Py3Init_vim);

0 commit comments

Comments
 (0)