Building Vim against Python 2.5

S

sjdevnull

[Any python/C interface gurus please correct me if my understanding is
wrong, as this fix is slated for inclusion in future versions of
vim--thanks!]

Just as a heads up for anyone building vim with python2.5 as the
extension language:

Simple solution: Python 2.5 has tightened up how it does memory
allocation, so you need to ":%s/PyMem_DEL/Py_DECREF" in if_python.c or
you'll see segfaults when trying to use :py or :pyf statements.

Longer explantation: Every instance of PyMem_DEL in if_python.c is on a
standard PyObject * allocated with Py_BuildValue or similar.

If I understand correctly, really, PyMem_DEL is only supposed to be
paired with PyMem_ALLOC and any PyObject * objects should be freed with
Py_DECREF. But in earlier versions the two internally used the same
allocater so it happened to work; Python 2.5 is stricter about this.

I've only tested with vim 7.0 and python 2.3 and 2.5, but the same
change should work fine in older versions of vim.

The fix has been sent to Bram so future versions of vim should build
fine out of the box against python 2.5.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top