0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.0867: cannot build Python interface with Python 2.4

Problem:    Cannot build Python interface with Python 2.4. (Tom G. Christensen)
Solution:   Define PyBytes_FromStringAndSize. (Ken Takata, closes #3888)
This commit is contained in:
Bram Moolenaar
2019-02-01 22:10:16 +01:00
parent 1c321dcee9
commit 65951258d6
2 changed files with 13 additions and 9 deletions

View File

@@ -73,9 +73,11 @@
#undef main /* Defined in python.h - aargh */ #undef main /* Defined in python.h - aargh */
#undef HAVE_FCNTL_H /* Clash with os_win32.h */ #undef HAVE_FCNTL_H /* Clash with os_win32.h */
// Perhaps leave this out for Python 2.6, which supports bytes?
#define PyBytes_FromString PyString_FromString #define PyBytes_FromString PyString_FromString
#define PyBytes_Check PyString_Check #define PyBytes_Check PyString_Check
#define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#if !defined(FEAT_PYTHON) && defined(PROTO) #if !defined(FEAT_PYTHON) && defined(PROTO)
/* Use this to be able to generate prototypes without python being used. */ /* Use this to be able to generate prototypes without python being used. */
@@ -120,10 +122,10 @@ struct PyMethodDef { Py_ssize_t a; };
# define PY_CAN_RECURSE # define PY_CAN_RECURSE
#endif #endif
# if defined(DYNAMIC_PYTHON) || defined(PROTO) #if defined(DYNAMIC_PYTHON) || defined(PROTO)
# ifndef DYNAMIC_PYTHON # ifndef DYNAMIC_PYTHON
# define HINSTANCE long_u /* for generating prototypes */ # define HINSTANCE long_u /* for generating prototypes */
# endif # endif
# ifndef WIN3264 # ifndef WIN3264
# include <dlfcn.h> # include <dlfcn.h>
@@ -489,15 +491,15 @@ static struct
PYTHON_PROC *ptr; PYTHON_PROC *ptr;
} python_funcname_table[] = } python_funcname_table[] =
{ {
#ifndef PY_SSIZE_T_CLEAN # ifndef PY_SSIZE_T_CLEAN
{"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse}, {"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
{"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue}, {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
#else # else
{"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse}, {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse},
{"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue}, {"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue},
#endif # endif
{"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free}, {"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc}, {"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc},
{"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString}, {"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString},
@@ -678,7 +680,7 @@ python_runtime_link_init(char *libname, int verbose)
PYTHON_PROC *ucs_as_encoded_string = PYTHON_PROC *ucs_as_encoded_string =
(PYTHON_PROC*)&py_PyUnicode_AsEncodedString; (PYTHON_PROC*)&py_PyUnicode_AsEncodedString;
#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) # 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. /* Can't have Python and Python3 loaded at the same time.
* It cause a crash, because RTLD_GLOBAL is needed for * It cause a crash, because RTLD_GLOBAL is needed for
* standard C extension libraries of one or both python versions. */ * standard C extension libraries of one or both python versions. */
@@ -688,7 +690,7 @@ python_runtime_link_init(char *libname, int verbose)
emsg(_("E836: This Vim cannot execute :python after using :py3")); emsg(_("E836: This Vim cannot execute :python after using :py3"));
return FAIL; return FAIL;
} }
#endif # endif
if (hinstPython) if (hinstPython)
return OK; return OK;

View File

@@ -783,6 +783,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
867,
/**/ /**/
866, 866,
/**/ /**/