|
Karsten Hopp |
cfbb2d |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
cfbb2d |
Subject: Patch 7.3.579
|
|
Karsten Hopp |
cfbb2d |
Fcc: outbox
|
|
Karsten Hopp |
cfbb2d |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
cfbb2d |
Mime-Version: 1.0
|
|
Karsten Hopp |
cfbb2d |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
cfbb2d |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
cfbb2d |
------------
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
Patch 7.3.579 (after 7.3.569)
|
|
Karsten Hopp |
cfbb2d |
Problem: Can't compile with Python 2.5.
|
|
Karsten Hopp |
cfbb2d |
Solution: Use PyCObject when Capsules are not available.
|
|
Karsten Hopp |
cfbb2d |
Files: src/if_py_both.h, src/if_python.c, src/if_python3.c
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
*** ../vim-7.3.578/src/if_py_both.h 2012-06-29 16:19:46.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
--- src/if_py_both.h 2012-06-29 16:15:29.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 56,62 ****
|
|
Karsten Hopp |
cfbb2d |
/* name, function, calling, documentation */
|
|
Karsten Hopp |
cfbb2d |
{"write", OutputWrite, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
{"writelines", OutputWritelines, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
! {"flush", OutputFlush, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
{ NULL, NULL, 0, NULL}
|
|
Karsten Hopp |
cfbb2d |
};
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
--- 56,62 ----
|
|
Karsten Hopp |
cfbb2d |
/* name, function, calling, documentation */
|
|
Karsten Hopp |
cfbb2d |
{"write", OutputWrite, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
{"writelines", OutputWritelines, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
! {"flush", OutputFlush, 1, ""},
|
|
Karsten Hopp |
cfbb2d |
{ NULL, NULL, 0, NULL}
|
|
Karsten Hopp |
cfbb2d |
};
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 506,513 ****
|
|
Karsten Hopp |
cfbb2d |
/* name, function, calling, documentation */
|
|
Karsten Hopp |
cfbb2d |
{"command", VimCommand, 1, "Execute a Vim ex-mode command" },
|
|
Karsten Hopp |
cfbb2d |
{"eval", VimEval, 1, "Evaluate an expression using Vim evaluator" },
|
|
Karsten Hopp |
cfbb2d |
! {"bindeval", VimEvalPy, 1, "Like eval(), but returns objects attached to vim ones"},
|
|
Karsten Hopp |
cfbb2d |
! {"strwidth", VimStrwidth, 1, "Screen string width, counts <Tab> as having width 1"},
|
|
Karsten Hopp |
cfbb2d |
{ NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
cfbb2d |
};
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
--- 506,513 ----
|
|
Karsten Hopp |
cfbb2d |
/* name, function, calling, documentation */
|
|
Karsten Hopp |
cfbb2d |
{"command", VimCommand, 1, "Execute a Vim ex-mode command" },
|
|
Karsten Hopp |
cfbb2d |
{"eval", VimEval, 1, "Evaluate an expression using Vim evaluator" },
|
|
Karsten Hopp |
cfbb2d |
! {"bindeval", VimEvalPy, 1, "Like eval(), but returns objects attached to vim ones"},
|
|
Karsten Hopp |
cfbb2d |
! {"strwidth", VimStrwidth, 1, "Screen string width, counts <Tab> as having width 1"},
|
|
Karsten Hopp |
cfbb2d |
{ NULL, NULL, 0, NULL }
|
|
Karsten Hopp |
cfbb2d |
};
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 2432,2448 ****
|
|
Karsten Hopp |
cfbb2d |
--- 2432,2463 ----
|
|
Karsten Hopp |
cfbb2d |
convert_dl(PyObject *obj, typval_T *tv,
|
|
Karsten Hopp |
cfbb2d |
pytotvfunc py_to_tv, PyObject *lookupDict)
|
|
Karsten Hopp |
cfbb2d |
{
|
|
Karsten Hopp |
cfbb2d |
+ # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
PyObject *capsule;
|
|
Karsten Hopp |
cfbb2d |
+ # else
|
|
Karsten Hopp |
cfbb2d |
+ PyCObject *cobject;
|
|
Karsten Hopp |
cfbb2d |
+ # endif
|
|
Karsten Hopp |
cfbb2d |
char hexBuf[sizeof(void *) * 2 + 3];
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
sprintf(hexBuf, "%p", obj);
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
+ # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
capsule = PyDict_GetItemString(lookupDict, hexBuf);
|
|
Karsten Hopp |
cfbb2d |
if (capsule == NULL)
|
|
Karsten Hopp |
cfbb2d |
+ # else
|
|
Karsten Hopp |
cfbb2d |
+ cobject = (PyCObject *)PyDict_GetItemString(lookupDict, hexBuf);
|
|
Karsten Hopp |
cfbb2d |
+ if (cobject == NULL)
|
|
Karsten Hopp |
cfbb2d |
+ # endif
|
|
Karsten Hopp |
cfbb2d |
{
|
|
Karsten Hopp |
cfbb2d |
+ # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
capsule = PyCapsule_New(tv, NULL, NULL);
|
|
Karsten Hopp |
cfbb2d |
PyDict_SetItemString(lookupDict, hexBuf, capsule);
|
|
Karsten Hopp |
cfbb2d |
Py_DECREF(capsule);
|
|
Karsten Hopp |
cfbb2d |
+ # else
|
|
Karsten Hopp |
cfbb2d |
+ cobject = PyCObject_FromVoidPtr(tv, NULL);
|
|
Karsten Hopp |
cfbb2d |
+ PyDict_SetItemString(lookupDict, hexBuf, cobject);
|
|
Karsten Hopp |
cfbb2d |
+ Py_DECREF(cobject);
|
|
Karsten Hopp |
cfbb2d |
+ # endif
|
|
Karsten Hopp |
cfbb2d |
if (py_to_tv(obj, tv, lookupDict) == -1)
|
|
Karsten Hopp |
cfbb2d |
{
|
|
Karsten Hopp |
cfbb2d |
tv->v_type = VAR_UNKNOWN;
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 2458,2464 ****
|
|
Karsten Hopp |
cfbb2d |
}
|
|
Karsten Hopp |
cfbb2d |
else
|
|
Karsten Hopp |
cfbb2d |
{
|
|
Karsten Hopp |
cfbb2d |
! typval_T *v = PyCapsule_GetPointer(capsule, NULL);
|
|
Karsten Hopp |
cfbb2d |
copy_tv(v, tv);
|
|
Karsten Hopp |
cfbb2d |
}
|
|
Karsten Hopp |
cfbb2d |
return 0;
|
|
Karsten Hopp |
cfbb2d |
--- 2473,2485 ----
|
|
Karsten Hopp |
cfbb2d |
}
|
|
Karsten Hopp |
cfbb2d |
else
|
|
Karsten Hopp |
cfbb2d |
{
|
|
Karsten Hopp |
cfbb2d |
! typval_T *v;
|
|
Karsten Hopp |
cfbb2d |
!
|
|
Karsten Hopp |
cfbb2d |
! # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
! v = PyCapsule_GetPointer(capsule, NULL);
|
|
Karsten Hopp |
cfbb2d |
! # else
|
|
Karsten Hopp |
cfbb2d |
! v = PyCObject_AsVoidPtr(cobject);
|
|
Karsten Hopp |
cfbb2d |
! # endif
|
|
Karsten Hopp |
cfbb2d |
copy_tv(v, tv);
|
|
Karsten Hopp |
cfbb2d |
}
|
|
Karsten Hopp |
cfbb2d |
return 0;
|
|
Karsten Hopp |
cfbb2d |
*** ../vim-7.3.578/src/if_python.c 2012-06-29 12:54:32.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
--- src/if_python.c 2012-06-29 16:17:44.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 71,76 ****
|
|
Karsten Hopp |
cfbb2d |
--- 71,80 ----
|
|
Karsten Hopp |
cfbb2d |
# define PySequenceMethods Py_ssize_t
|
|
Karsten Hopp |
cfbb2d |
#endif
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
+ #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000
|
|
Karsten Hopp |
cfbb2d |
+ # define PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
+ #endif
|
|
Karsten Hopp |
cfbb2d |
+
|
|
Karsten Hopp |
cfbb2d |
#if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000
|
|
Karsten Hopp |
cfbb2d |
# define PyInt Py_ssize_t
|
|
Karsten Hopp |
cfbb2d |
# define PyInquiry lenfunc
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 220,227 ****
|
|
Karsten Hopp |
cfbb2d |
# define PyObject_Malloc dll_PyObject_Malloc
|
|
Karsten Hopp |
cfbb2d |
# define PyObject_Free dll_PyObject_Free
|
|
Karsten Hopp |
cfbb2d |
# endif
|
|
Karsten Hopp |
cfbb2d |
! # define PyCapsule_New dll_PyCapsule_New
|
|
Karsten Hopp |
cfbb2d |
! # define PyCapsule_GetPointer dll_PyCapsule_GetPointer
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
/*
|
|
Karsten Hopp |
cfbb2d |
* Pointers for dynamic link
|
|
Karsten Hopp |
cfbb2d |
--- 224,236 ----
|
|
Karsten Hopp |
cfbb2d |
# define PyObject_Malloc dll_PyObject_Malloc
|
|
Karsten Hopp |
cfbb2d |
# define PyObject_Free dll_PyObject_Free
|
|
Karsten Hopp |
cfbb2d |
# endif
|
|
Karsten Hopp |
cfbb2d |
! # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
! # define PyCapsule_New dll_PyCapsule_New
|
|
Karsten Hopp |
cfbb2d |
! # define PyCapsule_GetPointer dll_PyCapsule_GetPointer
|
|
Karsten Hopp |
cfbb2d |
! # else
|
|
Karsten Hopp |
cfbb2d |
! # define PyCObject_FromVoidPtr dll_PyCObject_FromVoidPtr
|
|
Karsten Hopp |
cfbb2d |
! # define PyCObject_AsVoidPtr dll_PyCObject_AsVoidPtr
|
|
Karsten Hopp |
cfbb2d |
! # endif
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
/*
|
|
Karsten Hopp |
cfbb2d |
* Pointers for dynamic link
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 309,316 ****
|
|
Karsten Hopp |
cfbb2d |
--- 318,330 ----
|
|
Karsten Hopp |
cfbb2d |
static void* (*dll_PyObject_Malloc)(size_t);
|
|
Karsten Hopp |
cfbb2d |
static void (*dll_PyObject_Free)(void*);
|
|
Karsten Hopp |
cfbb2d |
# endif
|
|
Karsten Hopp |
cfbb2d |
+ # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
static PyObject* (*dll_PyCapsule_New)(void *, char *, PyCapsule_Destructor);
|
|
Karsten Hopp |
cfbb2d |
static void* (*dll_PyCapsule_GetPointer)(PyObject *, char *);
|
|
Karsten Hopp |
cfbb2d |
+ # else
|
|
Karsten Hopp |
cfbb2d |
+ static PyCObject* (*dll_PyCObject_FromVoidPtr)(void *cobj, void (*destr)(void *));
|
|
Karsten Hopp |
cfbb2d |
+ static void* (*dll_PyCObject_AsVoidPtr)(PyCObject *);
|
|
Karsten Hopp |
cfbb2d |
+ # endif
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
static HINSTANCE hinstPython = 0; /* Instance of python.dll */
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 403,409 ****
|
|
Karsten Hopp |
cfbb2d |
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
|
|
Karsten Hopp |
cfbb2d |
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
|
|
Karsten Hopp |
cfbb2d |
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
|
|
Karsten Hopp |
cfbb2d |
! # if (PY_VERSION_HEX >= 0x02050000) && SIZEOF_SIZE_T != SIZEOF_INT
|
|
Karsten Hopp |
cfbb2d |
{"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
|
|
Karsten Hopp |
cfbb2d |
# else
|
|
Karsten Hopp |
cfbb2d |
{"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
|
|
Karsten Hopp |
cfbb2d |
--- 417,424 ----
|
|
Karsten Hopp |
cfbb2d |
{"PyType_Ready", (PYTHON_PROC*)&dll_PyType_Ready},
|
|
Karsten Hopp |
cfbb2d |
{"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
|
|
Karsten Hopp |
cfbb2d |
{"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod},
|
|
Karsten Hopp |
cfbb2d |
! # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \
|
|
Karsten Hopp |
cfbb2d |
! && SIZEOF_SIZE_T != SIZEOF_INT
|
|
Karsten Hopp |
cfbb2d |
{"Py_InitModule4_64", (PYTHON_PROC*)&dll_Py_InitModule4},
|
|
Karsten Hopp |
cfbb2d |
# else
|
|
Karsten Hopp |
cfbb2d |
{"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4},
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 424,431 ****
|
|
Karsten Hopp |
cfbb2d |
--- 439,451 ----
|
|
Karsten Hopp |
cfbb2d |
{"PyObject_Malloc", (PYTHON_PROC*)&dll_PyObject_Malloc},
|
|
Karsten Hopp |
cfbb2d |
{"PyObject_Free", (PYTHON_PROC*)&dll_PyObject_Free},
|
|
Karsten Hopp |
cfbb2d |
# endif
|
|
Karsten Hopp |
cfbb2d |
+ # ifdef PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
{"PyCapsule_New", (PYTHON_PROC*)&dll_PyCapsule_New},
|
|
Karsten Hopp |
cfbb2d |
{"PyCapsule_GetPointer", (PYTHON_PROC*)&dll_PyCapsule_GetPointer},
|
|
Karsten Hopp |
cfbb2d |
+ # else
|
|
Karsten Hopp |
cfbb2d |
+ {"PyCObject_FromVoidPtr", (PYTHON_PROC*)&dll_PyCObject_FromVoidPtr},
|
|
Karsten Hopp |
cfbb2d |
+ {"PyCObject_AsVoidPtr", (PYTHON_PROC*)&dll_PyCObject_AsVoidPtr},
|
|
Karsten Hopp |
cfbb2d |
+ # endif
|
|
Karsten Hopp |
cfbb2d |
{"", NULL},
|
|
Karsten Hopp |
cfbb2d |
};
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
*** ../vim-7.3.578/src/if_python3.c 2012-06-29 12:54:32.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
--- src/if_python3.c 2012-06-29 16:16:54.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 75,80 ****
|
|
Karsten Hopp |
cfbb2d |
--- 75,83 ----
|
|
Karsten Hopp |
cfbb2d |
# define CODEC_ERROR_HANDLER NULL
|
|
Karsten Hopp |
cfbb2d |
#endif
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
+ /* Python 3 does not support CObjects, always use Capsules */
|
|
Karsten Hopp |
cfbb2d |
+ #define PY_USE_CAPSULE
|
|
Karsten Hopp |
cfbb2d |
+
|
|
Karsten Hopp |
cfbb2d |
#define PyInt Py_ssize_t
|
|
Karsten Hopp |
cfbb2d |
#define PyString_Check(obj) PyUnicode_Check(obj)
|
|
Karsten Hopp |
cfbb2d |
#define PyString_AsBytes(obj) PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, CODEC_ERROR_HANDLER)
|
|
Karsten Hopp |
cfbb2d |
*** ../vim-7.3.578/src/version.c 2012-06-29 16:19:46.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
--- src/version.c 2012-06-29 16:21:25.000000000 +0200
|
|
Karsten Hopp |
cfbb2d |
***************
|
|
Karsten Hopp |
cfbb2d |
*** 716,717 ****
|
|
Karsten Hopp |
cfbb2d |
--- 716,719 ----
|
|
Karsten Hopp |
cfbb2d |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
cfbb2d |
+ /**/
|
|
Karsten Hopp |
cfbb2d |
+ 579,
|
|
Karsten Hopp |
cfbb2d |
/**/
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
--
|
|
Karsten Hopp |
cfbb2d |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
cfbb2d |
78. You find yourself dialing IP numbers on the phone.
|
|
Karsten Hopp |
cfbb2d |
|
|
Karsten Hopp |
cfbb2d |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
cfbb2d |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
cfbb2d |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
cfbb2d |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|