Skip to content

Commit 6595125

Browse files
committed
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)
1 parent 1c321dc commit 6595125

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/if_python.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@
7373
#undef main /* Defined in python.h - aargh */
7474
#undef HAVE_FCNTL_H /* Clash with os_win32.h */
7575

76+
// Perhaps leave this out for Python 2.6, which supports bytes?
7677
#define PyBytes_FromString PyString_FromString
7778
#define PyBytes_Check PyString_Check
7879
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
80+
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
7981

8082
#if !defined(FEAT_PYTHON) && defined(PROTO)
8183
/* Use this to be able to generate prototypes without python being used. */
@@ -120,10 +122,10 @@ struct PyMethodDef { Py_ssize_t a; };
120122
# define PY_CAN_RECURSE
121123
#endif
122124

123-
# if defined(DYNAMIC_PYTHON) || defined(PROTO)
124-
# ifndef DYNAMIC_PYTHON
125-
# define HINSTANCE long_u /* for generating prototypes */
126-
# endif
125+
#if defined(DYNAMIC_PYTHON) || defined(PROTO)
126+
# ifndef DYNAMIC_PYTHON
127+
# define HINSTANCE long_u /* for generating prototypes */
128+
# endif
127129

128130
# ifndef WIN3264
129131
# include <dlfcn.h>
@@ -489,15 +491,15 @@ static struct
489491
PYTHON_PROC *ptr;
490492
} python_funcname_table[] =
491493
{
492-
#ifndef PY_SSIZE_T_CLEAN
494+
# ifndef PY_SSIZE_T_CLEAN
493495
{"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
494496
{"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
495497
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
496-
#else
498+
# else
497499
{"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse},
498500
{"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
499501
{"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue},
500-
#endif
502+
# endif
501503
{"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free},
502504
{"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc},
503505
{"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString},
@@ -678,7 +680,7 @@ python_runtime_link_init(char *libname, int verbose)
678680
PYTHON_PROC *ucs_as_encoded_string =
679681
(PYTHON_PROC*)&py_PyUnicode_AsEncodedString;
680682

681-
#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
683+
# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
682684
/* Can't have Python and Python3 loaded at the same time.
683685
* It cause a crash, because RTLD_GLOBAL is needed for
684686
* standard C extension libraries of one or both python versions. */
@@ -688,7 +690,7 @@ python_runtime_link_init(char *libname, int verbose)
688690
emsg(_("E836: This Vim cannot execute :python after using :py3"));
689691
return FAIL;
690692
}
691-
#endif
693+
# endif
692694

693695
if (hinstPython)
694696
return OK;

src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
867,
786788
/**/
787789
866,
788790
/**/

0 commit comments

Comments
 (0)