| To: vim_dev@googlegroups.com |
| Subject: Patch 7.3.062 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.3.062 |
| Problem: Python doesn't work properly when installed in another directory |
| than expected. |
| Solution: Figure out home directory in configure and use Py_SetPythonHome() |
| at runtime. (Roland Puntaier) |
| Files: src/configure.in, src/auto/configure, src/if_python.c, |
| src/if_python3.c |
| |
| |
| |
| |
| |
| *** 891,899 **** |
| |
| PYTHON_LIBS="${vi_cv_path_python_plibs}" |
| if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" |
| else |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" |
| fi |
| PYTHON_SRC="if_python.c" |
| dnl For Mac OSX 10.2 config.o is included in the Python library. |
| --- 891,899 ---- |
| |
| PYTHON_LIBS="${vi_cv_path_python_plibs}" |
| if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" |
| else |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" |
| fi |
| PYTHON_SRC="if_python.c" |
| dnl For Mac OSX 10.2 config.o is included in the Python library. |
| |
| *** 905,911 **** |
| if test "${vi_cv_var_python_version}" = "1.4"; then |
| PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" |
| fi |
| ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" |
| |
| dnl On FreeBSD linking with "-pthread" is required to use threads. |
| dnl _THREAD_SAFE must be used for compiling then. |
| --- 905,911 ---- |
| if test "${vi_cv_var_python_version}" = "1.4"; then |
| PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" |
| fi |
| ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" |
| |
| dnl On FreeBSD linking with "-pthread" is required to use threads. |
| dnl _THREAD_SAFE must be used for compiling then. |
| |
| *** 1063,1071 **** |
| |
| PYTHON3_LIBS="${vi_cv_path_python3_plibs}" |
| if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}" |
| else |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}" |
| fi |
| PYTHON3_SRC="if_python3.c" |
| dnl For Mac OSX 10.2 config.o is included in the Python library. |
| --- 1063,1071 ---- |
| |
| PYTHON3_LIBS="${vi_cv_path_python3_plibs}" |
| if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" |
| else |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" |
| fi |
| PYTHON3_SRC="if_python3.c" |
| dnl For Mac OSX 10.2 config.o is included in the Python library. |
| |
| *** 1143,1151 **** |
| if test "$python_ok" = yes && test "$python3_ok" = yes; then |
| AC_DEFINE(DYNAMIC_PYTHON) |
| AC_DEFINE(DYNAMIC_PYTHON3) |
| ! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL) |
| cflags_save=$CFLAGS |
| ! CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
| ldflags_save=$LDFLAGS |
| LDFLAGS="$LDFLAGS -ldl" |
| AC_RUN_IFELSE([ |
| --- 1143,1151 ---- |
| if test "$python_ok" = yes && test "$python3_ok" = yes; then |
| AC_DEFINE(DYNAMIC_PYTHON) |
| AC_DEFINE(DYNAMIC_PYTHON3) |
| ! AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python) |
| cflags_save=$CFLAGS |
| ! CFLAGS="$CFLAGS $PYTHON_CFLAGS" |
| ldflags_save=$LDFLAGS |
| LDFLAGS="$LDFLAGS -ldl" |
| AC_RUN_IFELSE([ |
| |
| *** 1156,1170 **** |
| * Only the first pyhton version used will be switched on. |
| */ |
| |
| ! int no_rtl_global_needed_for(char *python_instsoname) |
| { |
| int needed = 0; |
| void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| if (pylib != 0) |
| { |
| void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| (*init)(); |
| needed = (*simple)("import termios") == -1; |
| (*final)(); |
| --- 1156,1172 ---- |
| * Only the first pyhton version used will be switched on. |
| */ |
| |
| ! int no_rtl_global_needed_for(char *python_instsoname, char *prefix) |
| { |
| int needed = 0; |
| void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| if (pylib != 0) |
| { |
| + void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); |
| void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| + (*pfx)(prefix); |
| (*init)(); |
| needed = (*simple)("import termios") == -1; |
| (*final)(); |
| |
| *** 1176,1188 **** |
| int main(int argc, char** argv) |
| { |
| int not_needed = 0; |
| ! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0")) |
| not_needed = 1; |
| return !not_needed; |
| }], |
| [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) |
| CFLAGS=$cflags_save |
| LDFLAGS=$ldflags_save |
| PYTHON_SRC="if_python.c" |
| PYTHON_OBJ="objects/if_python.o" |
| PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" |
| --- 1178,1237 ---- |
| int main(int argc, char** argv) |
| { |
| int not_needed = 0; |
| ! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}")) |
| not_needed = 1; |
| return !not_needed; |
| }], |
| [AC_MSG_RESULT(yes);AC_DEFINE(PY_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) |
| + |
| CFLAGS=$cflags_save |
| LDFLAGS=$ldflags_save |
| + |
| + AC_MSG_CHECKING(whether we can do without RTLD_GLOBAL for Python3) |
| + cflags_save=$CFLAGS |
| + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
| + ldflags_save=$LDFLAGS |
| + LDFLAGS="$LDFLAGS -ldl" |
| + AC_RUN_IFELSE([ |
| + #include <dlfcn.h> |
| + #include <wchar.h> |
| + /* If this program fails, then RTLD_GLOBAL is needed. |
| + * RTLD_GLOBAL will be used and then it is not possible to |
| + * have both python versions enabled in the same vim instance. |
| + * Only the first pyhton version used will be switched on. |
| + */ |
| + |
| + int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) |
| + { |
| + int needed = 0; |
| + void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| + if (pylib != 0) |
| + { |
| + void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); |
| + void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| + void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| + (*pfx)(prefix); |
| + (*init)(); |
| + needed = (*simple)("import termios") == -1; |
| + (*final)(); |
| + dlclose(pylib); |
| + } |
| + return !needed; |
| + } |
| + |
| + int main(int argc, char** argv) |
| + { |
| + int not_needed = 0; |
| + if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}")) |
| + not_needed = 1; |
| + return !not_needed; |
| + }], |
| + [AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)]) |
| + |
| + CFLAGS=$cflags_save |
| + LDFLAGS=$ldflags_save |
| + |
| PYTHON_SRC="if_python.c" |
| PYTHON_OBJ="objects/if_python.o" |
| PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" |
| |
| |
| |
| *** 5326,5334 **** |
| |
| PYTHON_LIBS="${vi_cv_path_python_plibs}" |
| if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version}" |
| else |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version}" |
| fi |
| PYTHON_SRC="if_python.c" |
| if test "x$MACOSX" = "xyes"; then |
| --- 5326,5334 ---- |
| |
| PYTHON_LIBS="${vi_cv_path_python_plibs}" |
| if test "${vi_cv_path_python_pfx}" = "${vi_cv_path_python_epfx}"; then |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" |
| else |
| ! PYTHON_CFLAGS="-I${vi_cv_path_python_pfx}/include/python${vi_cv_var_python_version} -I${vi_cv_path_python_epfx}/include/python${vi_cv_var_python_version} -DPYTHON_HOME=\\\"${vi_cv_path_python_pfx}\\\"" |
| fi |
| PYTHON_SRC="if_python.c" |
| if test "x$MACOSX" = "xyes"; then |
| |
| *** 5339,5345 **** |
| if test "${vi_cv_var_python_version}" = "1.4"; then |
| PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" |
| fi |
| ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" |
| |
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 |
| $as_echo_n "checking if -pthread should be used... " >&6; } |
| --- 5339,5345 ---- |
| if test "${vi_cv_var_python_version}" = "1.4"; then |
| PYTHON_OBJ="$PYTHON_OBJ objects/py_getpath.o" |
| fi |
| ! PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" |
| |
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread should be used" >&5 |
| $as_echo_n "checking if -pthread should be used... " >&6; } |
| |
| *** 5601,5609 **** |
| |
| PYTHON3_LIBS="${vi_cv_path_python3_plibs}" |
| if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version}" |
| else |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version}" |
| fi |
| PYTHON3_SRC="if_python3.c" |
| if test "x$MACOSX" = "xyes"; then |
| --- 5601,5609 ---- |
| |
| PYTHON3_LIBS="${vi_cv_path_python3_plibs}" |
| if test "${vi_cv_path_python3_pfx}" = "${vi_cv_path_python3_epfx}"; then |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" |
| else |
| ! PYTHON3_CFLAGS="-I${vi_cv_path_python3_pfx}/include/python${vi_cv_var_python3_version} -I${vi_cv_path_python3_epfx}/include/python${vi_cv_var_python3_version} -DPYTHON3_HOME=L\\\"${vi_cv_path_python3_pfx}\\\"" |
| fi |
| PYTHON3_SRC="if_python3.c" |
| if test "x$MACOSX" = "xyes"; then |
| |
| *** 5708,5717 **** |
| |
| $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h |
| |
| ! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL" >&5 |
| ! $as_echo_n "checking whether we can do without RTLD_GLOBAL... " >&6; } |
| cflags_save=$CFLAGS |
| ! CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
| ldflags_save=$LDFLAGS |
| LDFLAGS="$LDFLAGS -ldl" |
| if test "$cross_compiling" = yes; then : |
| --- 5708,5717 ---- |
| |
| $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h |
| |
| ! { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python" >&5 |
| ! $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6; } |
| cflags_save=$CFLAGS |
| ! CFLAGS="$CFLAGS $PYTHON_CFLAGS" |
| ldflags_save=$LDFLAGS |
| LDFLAGS="$LDFLAGS -ldl" |
| if test "$cross_compiling" = yes; then : |
| |
| *** 5730,5744 **** |
| * Only the first pyhton version used will be switched on. |
| */ |
| |
| ! int no_rtl_global_needed_for(char *python_instsoname) |
| { |
| int needed = 0; |
| void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| if (pylib != 0) |
| { |
| void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| (*init)(); |
| needed = (*simple)("import termios") == -1; |
| (*final)(); |
| --- 5730,5746 ---- |
| * Only the first pyhton version used will be switched on. |
| */ |
| |
| ! int no_rtl_global_needed_for(char *python_instsoname, char *prefix) |
| { |
| int needed = 0; |
| void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| if (pylib != 0) |
| { |
| + void (*pfx)(char *home) = dlsym(pylib, "Py_SetPythonHome"); |
| void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| + (*pfx)(prefix); |
| (*init)(); |
| needed = (*simple)("import termios") == -1; |
| (*final)(); |
| |
| *** 5750,5756 **** |
| int main(int argc, char** argv) |
| { |
| int not_needed = 0; |
| ! if (no_rtl_global_needed_for("libpython2.7.so.1.0") && no_rtl_global_needed_for("libpython3.1.so.1.0")) |
| not_needed = 1; |
| return !not_needed; |
| } |
| --- 5752,5758 ---- |
| int main(int argc, char** argv) |
| { |
| int not_needed = 0; |
| ! if (no_rtl_global_needed_for("${python_INSTSONAME}", "${vi_cv_path_python_pfx}")) |
| not_needed = 1; |
| return !not_needed; |
| } |
| |
| *** 5767,5774 **** |
| --- 5769,5844 ---- |
| conftest.$ac_objext conftest.beam conftest.$ac_ext |
| fi |
| |
| + |
| CFLAGS=$cflags_save |
| LDFLAGS=$ldflags_save |
| + |
| + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can do without RTLD_GLOBAL for Python3" >&5 |
| + $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python3... " >&6; } |
| + cflags_save=$CFLAGS |
| + CFLAGS="$CFLAGS $PYTHON3_CFLAGS" |
| + ldflags_save=$LDFLAGS |
| + LDFLAGS="$LDFLAGS -ldl" |
| + if test "$cross_compiling" = yes; then : |
| + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
| + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} |
| + as_fn_error "cannot run test program while cross compiling |
| + See \`config.log' for more details." "$LINENO" 5; } |
| + else |
| + cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| + /* end confdefs.h. */ |
| + |
| + #include <dlfcn.h> |
| + #include <wchar.h> |
| + /* If this program fails, then RTLD_GLOBAL is needed. |
| + * RTLD_GLOBAL will be used and then it is not possible to |
| + * have both python versions enabled in the same vim instance. |
| + * Only the first pyhton version used will be switched on. |
| + */ |
| + |
| + int no_rtl_global_needed_for(char *python_instsoname, wchar_t *prefix) |
| + { |
| + int needed = 0; |
| + void* pylib = dlopen(python_instsoname, RTLD_LAZY); |
| + if (pylib != 0) |
| + { |
| + void (*pfx)(wchar_t *home) = dlsym(pylib, "Py_SetPythonHome"); |
| + void (*init)(void) = dlsym(pylib, "Py_Initialize"); |
| + int (*simple)(char*) = dlsym(pylib, "PyRun_SimpleString"); |
| + void (*final)(void) = dlsym(pylib, "Py_Finalize"); |
| + (*pfx)(prefix); |
| + (*init)(); |
| + needed = (*simple)("import termios") == -1; |
| + (*final)(); |
| + dlclose(pylib); |
| + } |
| + return !needed; |
| + } |
| + |
| + int main(int argc, char** argv) |
| + { |
| + int not_needed = 0; |
| + if (no_rtl_global_needed_for("${python3_INSTSONAME}", L"${vi_cv_path_python3_pfx}")) |
| + not_needed = 1; |
| + return !not_needed; |
| + } |
| + _ACEOF |
| + if ac_fn_c_try_run "$LINENO"; then : |
| + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
| + $as_echo "yes" >&6; };$as_echo "#define PY3_NO_RTLD_GLOBAL 1" >>confdefs.h |
| + |
| + else |
| + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
| + $as_echo "no" >&6; } |
| + fi |
| + rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ |
| + conftest.$ac_objext conftest.beam conftest.$ac_ext |
| + fi |
| + |
| + |
| + CFLAGS=$cflags_save |
| + LDFLAGS=$ldflags_save |
| + |
| PYTHON_SRC="if_python.c" |
| PYTHON_OBJ="objects/if_python.o" |
| PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\"" |
| |
| |
| |
| *** 102,108 **** |
| # include <dlfcn.h> |
| # define FARPROC void* |
| # define HINSTANCE void* |
| ! # ifdef PY_NO_RTLD_GLOBAL |
| # define load_dll(n) dlopen((n), RTLD_LAZY) |
| # else |
| # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) |
| --- 102,108 ---- |
| # include <dlfcn.h> |
| # define FARPROC void* |
| # define HINSTANCE void* |
| ! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL) |
| # define load_dll(n) dlopen((n), RTLD_LAZY) |
| # else |
| # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) |
| |
| *** 168,173 **** |
| --- 168,174 ---- |
| # define Py_BuildValue dll_Py_BuildValue |
| # define Py_FindMethod dll_Py_FindMethod |
| # define Py_InitModule4 dll_Py_InitModule4 |
| + # define Py_SetPythonHome dll_Py_SetPythonHome |
| # define Py_Initialize dll_Py_Initialize |
| # define Py_Finalize dll_Py_Finalize |
| # define Py_IsInitialized dll_Py_IsInitialized |
| |
| *** 226,231 **** |
| --- 227,233 ---- |
| static PyObject*(*dll_Py_BuildValue)(char *, ...); |
| static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *); |
| static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int); |
| + static void(*dll_Py_SetPythonHome)(char *home); |
| static void(*dll_Py_Initialize)(void); |
| static void(*dll_Py_Finalize)(void); |
| static int(*dll_Py_IsInitialized)(void); |
| |
| *** 310,315 **** |
| --- 312,318 ---- |
| # else |
| {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4}, |
| # endif |
| + {"Py_SetPythonHome", (PYTHON_PROC*)&dll_Py_SetPythonHome}, |
| {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize}, |
| {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize}, |
| {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized}, |
| |
| *** 349,355 **** |
| { |
| int i; |
| |
| ! #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. */ |
| --- 352,358 ---- |
| { |
| int i; |
| |
| ! #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_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. */ |
| |
| *** 543,548 **** |
| --- 546,555 ---- |
| } |
| #endif |
| |
| + #ifdef PYTHON_HOME |
| + Py_SetPythonHome(PYTHON_HOME); |
| + #endif |
| + |
| init_structs(); |
| |
| #if !defined(MACOS) || defined(MACOS_X_UNIX) |
| |
| |
| |
| *** 80,86 **** |
| # include <dlfcn.h> |
| # define FARPROC void* |
| # define HINSTANCE void* |
| ! # ifdef PY_NO_RTLD_GLOBAL |
| # define load_dll(n) dlopen((n), RTLD_LAZY) |
| # else |
| # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) |
| --- 80,86 ---- |
| # include <dlfcn.h> |
| # define FARPROC void* |
| # define HINSTANCE void* |
| ! # if defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL) |
| # define load_dll(n) dlopen((n), RTLD_LAZY) |
| # else |
| # define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) |
| |
| *** 132,137 **** |
| --- 132,138 ---- |
| # define PyType_Ready py3_PyType_Ready |
| #undef Py_BuildValue |
| # define Py_BuildValue py3_Py_BuildValue |
| + # define Py_SetPythonHome py3_Py_SetPythonHome |
| # define Py_Initialize py3_Py_Initialize |
| # define Py_Finalize py3_Py_Finalize |
| # define Py_IsInitialized py3_Py_IsInitialized |
| |
| *** 170,175 **** |
| --- 171,177 ---- |
| * Pointers for dynamic link |
| */ |
| static int (*py3_PySys_SetArgv)(int, wchar_t **); |
| + static void (*py3_Py_SetPythonHome)(wchar_t *home); |
| static void (*py3_Py_Initialize)(void); |
| static PyObject* (*py3_PyList_New)(Py_ssize_t size); |
| static PyGILState_STATE (*py3_PyGILState_Ensure)(void); |
| |
| *** 254,259 **** |
| --- 256,262 ---- |
| } py3_funcname_table[] = |
| { |
| {"PySys_SetArgv", (PYTHON_PROC*)&py3_PySys_SetArgv}, |
| + {"Py_SetPythonHome", (PYTHON_PROC*)&py3_Py_SetPythonHome}, |
| {"Py_Initialize", (PYTHON_PROC*)&py3_Py_Initialize}, |
| {"PyArg_ParseTuple", (PYTHON_PROC*)&py3_PyArg_ParseTuple}, |
| {"PyList_New", (PYTHON_PROC*)&py3_PyList_New}, |
| |
| *** 336,342 **** |
| int i; |
| void *ucs_from_string, *ucs_from_string_and_size; |
| |
| ! # if !defined(PY_NO_RTLD_GLOBAL) && defined(UNIX) && defined(FEAT_PYTHON) |
| /* 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. */ |
| --- 339,345 ---- |
| int i; |
| void *ucs_from_string, *ucs_from_string_and_size; |
| |
| ! # if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON) |
| /* 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. */ |
| |
| *** 539,544 **** |
| --- 542,552 ---- |
| |
| init_structs(); |
| |
| + |
| + #ifdef PYTHON3_HOME |
| + Py_SetPythonHome(PYTHON3_HOME); |
| + #endif |
| + |
| /* initialise threads */ |
| PyEval_InitThreads(); |
| |
| |
| |
| |
| *** 716,717 **** |
| --- 716,719 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 62, |
| /**/ |
| |
| -- |
| ARTHUR: CHARGE! |
| [The mighty ARMY charges. Thundering noise of feet. Clatter of coconuts. |
| Shouts etc. Suddenly there is a wail of a siren and a couple of police |
| cars roar round in front of the charging ARMY and the POLICE leap out and |
| stop them. TWO POLICEMAN and the HISTORIAN'S WIFE. Black Marias skid up |
| behind them.] |
| HISTORIAN'S WIFE: They're the ones, I'm sure. |
| "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |