forked from aniani/vim
When building with both Python 2 and Python 3 don't use RTLD_GLOBAL, so that
both may work.
This commit is contained in:
parent
82d1c33a8a
commit
b61f95c31f
@ -408,6 +408,8 @@ CClink = $(CC)
|
||||
# ln -s python3 python3.1
|
||||
# If both python2.x and python3.x are enabled then the linking will be via
|
||||
# dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available
|
||||
# However, this may still cause problems, such as "import termios" failing.
|
||||
# Build two separate versions of Vim in that case.
|
||||
#CONF_OPT_PYTHON = --enable-pythoninterp
|
||||
#CONF_OPT_PYTHON3 = --enable-python3interp
|
||||
|
||||
|
@ -102,7 +102,13 @@ struct PyMethodDef { Py_ssize_t a; };
|
||||
# include <dlfcn.h>
|
||||
# define FARPROC void*
|
||||
# define HINSTANCE void*
|
||||
# ifdef FEAT_PYTHON3
|
||||
/* Don't use RTLD_GLOBAL, it may cause a crash if both :python and :py3 are
|
||||
* used. But without it importing may fail, e.g., for termios. */
|
||||
# define load_dll(n) dlopen((n), RTLD_LAZY)
|
||||
# else
|
||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||
# endif
|
||||
# define close_dll dlclose
|
||||
# define symbol_from_dll dlsym
|
||||
# else
|
||||
@ -345,6 +351,7 @@ python_runtime_link_init(char *libname, int verbose)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if 0 /* this should be OK now that we don't use RTLD_GLOBAL */
|
||||
#if defined(UNIX) && defined(FEAT_PYTHON3)
|
||||
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
||||
* crash. */
|
||||
@ -353,6 +360,7 @@ python_runtime_link_init(char *libname, int verbose)
|
||||
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (hinstPython)
|
||||
|
@ -80,7 +80,13 @@ static void init_structs(void);
|
||||
# include <dlfcn.h>
|
||||
# define FARPROC void*
|
||||
# define HINSTANCE void*
|
||||
# ifdef FEAT_PYTHON
|
||||
/* Don't use RTLD_GLOBAL, it may cause a crash if both :python and :py3 are
|
||||
* used. But without it importing may fail, e.g., for termios. */
|
||||
# define load_dll(n) dlopen((n), RTLD_LAZY)
|
||||
# else
|
||||
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||
# endif
|
||||
# define close_dll dlclose
|
||||
# define symbol_from_dll dlsym
|
||||
# else
|
||||
@ -161,6 +167,7 @@ static void init_structs(void);
|
||||
( (type *) PyObject_Init( \
|
||||
(PyObject *) _PyObject_DebugMalloc( _PyObject_SIZE(typeobj) ), (typeobj)) )
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Pointers for dynamic link
|
||||
*/
|
||||
@ -331,6 +338,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
||||
int i;
|
||||
void *ucs_from_string, *ucs_from_string_and_size;
|
||||
|
||||
# if 0 /* this should be OK now that we don't use RTLD_GLOBAL */
|
||||
# if defined(UNIX) && defined(FEAT_PYTHON)
|
||||
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
||||
* crash. */
|
||||
@ -339,6 +347,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
||||
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
||||
return FAIL;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
if (hinstPy3 != 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user