Hi all,
Python 2.5 has tightened up the way it handles memory
allocation, and there's a mis-match in the way that
if_python.c handles memory allocation which worked
with earlier Python versions but causes vim to
seg-fault with 2.5. Essentially, PyMem_DEL shouldn't
be paired with PyObject allocations--they should use
Py_DECREF.
Since every PyMem_DEL in if_python.c is on a PyObject
*, they should all be replaced with Py_DECREF.
This should be safe with earlier python versions as
well as with 2.5 (I've tested with 2.3 and 2.5).
Patch attached, though a simple
%s/PyMem_DEL/Py_DECREF/ is fine.
Thanks for your time,
Sumner
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- vim70/src/if_python.c 2006-04-30 11:31:36.000000000 -0400
+++ vim-new/src/if_python.c 2006-09-19 13:10:26.049857626 -0400
@@ -1463,7 +1463,7 @@
if (this->buf && this->buf != INVALID_BUFFER_VALUE)
this->buf->b_python_ref = NULL;
- PyMem_DEL(self);
+ Py_DECREF(self);
}
static PyObject *
@@ -1674,7 +1674,7 @@
bufr = (BufferObject *)BufferNew(buf);
if (bufr == NULL)
{
- PyMem_DEL(self);
+ Py_DECREF(self);
return NULL;
}
Py_INCREF(bufr);
@@ -1690,7 +1690,7 @@
RangeDestructor(PyObject *self)
{
Py_DECREF(((RangeObject *)(self))->buf);
- PyMem_DEL(self);
+ Py_DECREF(self);
}
static PyObject *
@@ -1944,7 +1944,7 @@
if (this->win && this->win != INVALID_WINDOW_VALUE)
this->win->w_python_ref = NULL;
- PyMem_DEL(self);
+ Py_DECREF(self);
}
static int