To: vim_dev@googlegroups.com Subject: Patch 8.1.0867 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0867 Problem: Cannot build Python interface with Python 2.4. (Tom G. Christensen) Solution: Define PyBytes_FromStringAndSize. (Ken Takata, closes #3888) Files: src/if_python.c *** ../vim-8.1.0866/src/if_python.c 2019-01-13 23:38:33.395773275 +0100 --- src/if_python.c 2019-02-01 22:09:15.742599161 +0100 *************** *** 73,81 **** --- 73,83 ---- #undef main /* Defined in python.h - aargh */ #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_Check PyString_Check #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_FromStringAndSize PyString_FromStringAndSize #if !defined(FEAT_PYTHON) && defined(PROTO) /* Use this to be able to generate prototypes without python being used. */ *************** *** 120,129 **** # define PY_CAN_RECURSE #endif ! # if defined(DYNAMIC_PYTHON) || defined(PROTO) ! # ifndef DYNAMIC_PYTHON ! # define HINSTANCE long_u /* for generating prototypes */ ! # endif # ifndef WIN3264 # include --- 122,131 ---- # define PY_CAN_RECURSE #endif ! #if defined(DYNAMIC_PYTHON) || defined(PROTO) ! # ifndef DYNAMIC_PYTHON ! # define HINSTANCE long_u /* for generating prototypes */ ! # endif # ifndef WIN3264 # include *************** *** 489,503 **** PYTHON_PROC *ptr; } python_funcname_table[] = { ! #ifndef PY_SSIZE_T_CLEAN {"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse}, {"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue}, ! #else {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse}, {"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue}, ! #endif {"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free}, {"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc}, {"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString}, --- 491,505 ---- PYTHON_PROC *ptr; } python_funcname_table[] = { ! # ifndef PY_SSIZE_T_CLEAN {"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse}, {"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue}, ! # else {"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse}, {"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple}, {"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue}, ! # endif {"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free}, {"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc}, {"PyDict_SetItemString", (PYTHON_PROC*)&dll_PyDict_SetItemString}, *************** *** 678,684 **** PYTHON_PROC *ucs_as_encoded_string = (PYTHON_PROC*)&py_PyUnicode_AsEncodedString; ! #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. * It cause a crash, because RTLD_GLOBAL is needed for * standard C extension libraries of one or both python versions. */ --- 680,686 ---- PYTHON_PROC *ucs_as_encoded_string = (PYTHON_PROC*)&py_PyUnicode_AsEncodedString; ! # 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. * It cause a crash, because RTLD_GLOBAL is needed for * standard C extension libraries of one or both python versions. */ *************** *** 688,694 **** emsg(_("E836: This Vim cannot execute :python after using :py3")); return FAIL; } ! #endif if (hinstPython) return OK; --- 690,696 ---- emsg(_("E836: This Vim cannot execute :python after using :py3")); return FAIL; } ! # endif if (hinstPython) return OK; *** ../vim-8.1.0866/src/version.c 2019-02-01 20:42:18.718884011 +0100 --- src/version.c 2019-02-01 22:09:48.697309931 +0100 *************** *** 785,786 **** --- 785,788 ---- { /* Add new patch number below this line */ + /**/ + 867, /**/ -- Vi beats Emacs to death, and then again! http://linuxtoday.com/stories/5764.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///