mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
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
|
# ln -s python3 python3.1
|
||||||
# If both python2.x and python3.x are enabled then the linking will be via
|
# 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
|
# 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_PYTHON = --enable-pythoninterp
|
||||||
#CONF_OPT_PYTHON3 = --enable-python3interp
|
#CONF_OPT_PYTHON3 = --enable-python3interp
|
||||||
|
|
||||||
|
@ -102,7 +102,13 @@ struct PyMethodDef { Py_ssize_t a; };
|
|||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# define FARPROC void*
|
# define FARPROC void*
|
||||||
# define HINSTANCE 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)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
|
# endif
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# else
|
# else
|
||||||
@ -345,6 +351,7 @@ python_runtime_link_init(char *libname, int verbose)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#if 0 /* this should be OK now that we don't use RTLD_GLOBAL */
|
||||||
#if defined(UNIX) && defined(FEAT_PYTHON3)
|
#if defined(UNIX) && defined(FEAT_PYTHON3)
|
||||||
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
||||||
* crash. */
|
* crash. */
|
||||||
@ -353,6 +360,7 @@ python_runtime_link_init(char *libname, int verbose)
|
|||||||
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (hinstPython)
|
if (hinstPython)
|
||||||
|
@ -80,7 +80,13 @@ static void init_structs(void);
|
|||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
# define FARPROC void*
|
# define FARPROC void*
|
||||||
# define HINSTANCE 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)
|
# define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL)
|
||||||
|
# endif
|
||||||
# define close_dll dlclose
|
# define close_dll dlclose
|
||||||
# define symbol_from_dll dlsym
|
# define symbol_from_dll dlsym
|
||||||
# else
|
# else
|
||||||
@ -161,6 +167,7 @@ static void init_structs(void);
|
|||||||
( (type *) PyObject_Init( \
|
( (type *) PyObject_Init( \
|
||||||
(PyObject *) _PyObject_DebugMalloc( _PyObject_SIZE(typeobj) ), (typeobj)) )
|
(PyObject *) _PyObject_DebugMalloc( _PyObject_SIZE(typeobj) ), (typeobj)) )
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pointers for dynamic link
|
* Pointers for dynamic link
|
||||||
*/
|
*/
|
||||||
@ -331,6 +338,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
|||||||
int i;
|
int i;
|
||||||
void *ucs_from_string, *ucs_from_string_and_size;
|
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)
|
# if defined(UNIX) && defined(FEAT_PYTHON)
|
||||||
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
/* Can't have Python and Python3 loaded at the same time, it may cause a
|
||||||
* crash. */
|
* crash. */
|
||||||
@ -339,6 +347,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
|||||||
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
EMSG(_("E999: Python: Cannot use :py and :py3 in one session"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (hinstPy3 != 0)
|
if (hinstPy3 != 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user