Re: Is python 2.5 supported?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
Subject: Re: Is python 2.5 supported?
Date: 2006-11-06 15:49:42
Message-ID: 11160.1162828182@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Jim C. Nasby wrote:
>> Since installing python 2.5, tapir has been failing:

> I have removed the use of the deprecated whrandom module, which should
> take care of one regression test failure, but after that I get

> *** glibc detected *** free(): invalid pointer: 0xa5df6e78 ***
> LOG: server process (PID 1720) was terminated by signal 6

A bit of study of the Python documentation suggests that plpython.c is
taking a whole lot of shortcuts in setting up its Python type objects.
For me, this crash goes away with the attached patch ... but I don't
know if it might fail with old Python versions.

There are still a number of regression test diffs, which all look like
Python 2.5 has unilaterally changed the format of object descriptions, eg
! DETAIL: plpy.SPIError: Unknown error in PLy_spi_prepare
vs
! DETAIL: <class 'plpy.SPIError'>: Unknown error in PLy_spi_prepare
Probably there's no help for that except to have two expected files.

regards, tom lane

Index: plpython.c
===================================================================
RCS file: /cvsroot/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.89
diff -c -r1.89 plpython.c
*** plpython.c 4 Oct 2006 00:30:14 -0000 1.89
--- plpython.c 6 Nov 2006 15:45:58 -0000
***************
*** 1981,1987 ****
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
! 0, /* tp_xxx4 */
PLy_plan_doc, /* tp_doc */
};

--- 1981,1987 ----
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PLy_plan_doc, /* tp_doc */
};

***************
*** 2026,2032 ****
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
! 0, /* tp_xxx4 */
PLy_result_doc, /* tp_doc */
};

--- 2026,2032 ----
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PLy_result_doc, /* tp_doc */
};

***************
*** 2098,2104 ****
PLy_free(ob->args);
}

! PyMem_DEL(arg);
}


--- 2098,2104 ----
PLy_free(ob->args);
}

! arg->ob_type->tp_free(arg);
}


***************
*** 2152,2158 ****
Py_XDECREF(ob->rows);
Py_XDECREF(ob->status);

! PyMem_DEL(ob);
}

static PyObject *
--- 2152,2158 ----
Py_XDECREF(ob->rows);
Py_XDECREF(ob->status);

! arg->ob_type->tp_free(arg);
}

static PyObject *
***************
*** 2701,2707 ****
/*
* initialize plpy module
*/
! PLy_PlanType.ob_type = PLy_ResultType.ob_type = &PyType_Type;
plpy = Py_InitModule("plpy", PLy_methods);
plpy_dict = PyModule_GetDict(plpy);

--- 2701,2711 ----
/*
* initialize plpy module
*/
! if (PyType_Ready(&PLy_PlanType) < 0)
! elog(ERROR, "could not init PLy_PlanType");
! if (PyType_Ready(&PLy_ResultType) < 0)
! elog(ERROR, "could not init PLy_ResultType");
!
plpy = Py_InitModule("plpy", PLy_methods);
plpy_dict = PyModule_GetDict(plpy);

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-11-06 18:12:25 Re: adminpack and pg_catalog
Previous Message Andrew Dunstan 2006-11-06 14:12:32 Re: Indicate disabled triggers in \d