-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dear Inline::Python maintainers,
Inline::Python 0.22 no longer passes its test suite on Linux i386
under Ubuntu Feisty (Perl 5.8.8, Python 1.5.2 - Edgy works fine). The
problem seems to stem from an API change in Python at or about version
1.5.2: according to
http://mail.python.org/pipermail/python-bugs-list/2000-April/000709.html
it is not kosher (anymore?) to allocate stuff with PyObject_NEW and
free it with PyMem_DEL.
The attached patch:
* fixes an (unrelated) off-by-one malloc error in special_perl_use;
* replaces all occurences of PyMem_DEL with PyObject_FREE
and causes the test suite to succeed again.
Disclaimer: I am *not* a Python guy. The PyObject_FREE is just my
uneducated guess, and I'm not positive it is the Right Thing (in
particular, I didn't check for leaks in my Inline::Python so patched).
FWIW according to http://www.google.com/codesearch PyObject_FREE has
been around for ages, so hopefully my patch doesn't break backwards
compatibility.
Please apply. Oh, and cheers for your great work on Inline::Python!
- --
<< Tout n'y est pas parfait, mais on y honore certainement les
jardiniers >>
Dominique Quatravaux <[EMAIL PROTECTED]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBRjIqM/TYH7KfeIIFAQIDJQQAvWNYmEc8JCT+RRikrEWxkqFAp4ZlGUjV
lFD4OIuziVmT6Ygkyv58ieLFHFdh4z4RKg5Y5vu0+TC+54UefFG6ST5CyzbyMDkV
iuPyzMdm3q5HSHm6GgXthTsNqE81w9ub3xMxXVIFbTHTybd4aBK36Mkhf7qjvvjz
DGZ9JPWmqUk=
=9Jrz
-----END PGP SIGNATURE-----
=== perlmodule.c
==================================================================
--- perlmodule.c (/upstream) (revision 2)
+++ perlmodule.c (/work/malloc-issues) (local)
@@ -86,7 +86,7 @@
Py_XDECREF(self->pkg);
Py_XDECREF(self->base);
Py_XDECREF(self->full);
- PyMem_DEL(self);
+ PyObject_FREE(self);
}
static PyObject *
@@ -205,7 +205,7 @@
if (self->obj) SvREFCNT_dec(self->obj);
- PyMem_DEL(self);
+ PyObject_FREE(self);
}
static PyObject *
@@ -359,7 +359,7 @@
if (self->obj) SvREFCNT_dec(self->obj);
if (self->ref) SvREFCNT_dec(self->ref);
- PyMem_DEL(self);
+ PyObject_FREE(self);
}
static PyObject *
@@ -599,17 +599,18 @@
static PyObject * special_perl_use(PyObject *ignored, PyObject *args) {
PyObject *s = PyTuple_GetItem(args, 0);
- char *str;
+ char *str, *usewhat;
if(!PyString_Check(s)) {
return NULL;
}
- Printf(("calling use...'%s'\n", PyString_AsString(s)));
+ usewhat = PyString_AsString(s);
+ Printf(("calling use...'%s'\n", usewhat));
str = malloc((strlen("use ")
- + PyObject_Length(s)) * sizeof(char));
- sprintf(str, "use %s", PyString_AsString(s));
+ + strlen(usewhat) + 1) * sizeof(char));
+ sprintf(str, "use %s", usewhat);
Printf(("eval-ing now!\n"));
perl_eval_pv(str, TRUE);