Skip to content

Commit 0dbb762

Browse files
committed
Prevent SIGSEGV using both python and python3
$ vim --cmd 'py3 print("test")' --cmd 'py print("test")' $ vim --cmd 'py print("test")' --cmd 'py3 print("test")' It causes SIGSEGV. Technically, it would work with special Python2 built and Python3 built. However Python2 in OS X System and Python3 in Homebrew don't have the capability at all. This patch prevents SIGSEGV and make Vim can track the situation properly. $ vim --cmd 'py print("test")' --cmd 'py3 print("test")' E837: This Vim cannot execute :py3 after using :python E263: Sorry, this command is disabled, the Python library could not be loaded.
1 parent b8d8fb1 commit 0dbb762

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/auto/configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6447,6 +6447,7 @@ $as_echo_n "checking whether we can do without RTLD_GLOBAL for Python... " >&6;
64476447
CFLAGS="$CFLAGS $PYTHON_CFLAGS"
64486448
libs_save=$LIBS
64496449
LIBS="-ldl $LIBS"
6450+
if test "x$MACOSX" != "xyes"; then
64506451
if test "$cross_compiling" = yes; then :
64516452
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
64526453
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
@@ -6568,6 +6569,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
65686569
conftest.$ac_objext conftest.beam conftest.$ac_ext
65696570
fi
65706571

6572+
fi
65716573

65726574
CFLAGS=$cflags_save
65736575
LIBS=$libs_save

src/configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,6 +1520,7 @@ if test "$python_ok" = yes && test "$python3_ok" = yes; then
15201520
libs_save=$LIBS
15211521
dnl -ldl must go first to make this work on Archlinux (Roland Puntaier)
15221522
LIBS="-ldl $LIBS"
1523+
if test "x$MACOSX" != "xyes"; then
15231524
AC_RUN_IFELSE([AC_LANG_SOURCE([
15241525
#include <dlfcn.h>
15251526
/* If this program fails, then RTLD_GLOBAL is needed.
@@ -1601,6 +1602,7 @@ if test "$python_ok" = yes && test "$python3_ok" = yes; then
16011602
return !not_needed;
16021603
}])],
16031604
[AC_MSG_RESULT(yes);AC_DEFINE(PY3_NO_RTLD_GLOBAL)], [AC_MSG_RESULT(no)])
1605+
fi
16041606

16051607
CFLAGS=$cflags_save
16061608
LIBS=$libs_save

0 commit comments

Comments
 (0)