mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Revert "PL/Python: Remove workaround for returning booleans in Python <2.3"
This reverts commit be0dfbad36
.
The previous information that Py_RETURN_TRUE and Py_RETURN_FALSE are
supported in Python 2.3 is wrong. They require Python 2.4. Update the
comment about that.
This commit is contained in:
@ -492,9 +492,15 @@ PLy_input_datum_func2(PLyDatumToOb *arg, Oid typeOid, HeapTuple typeTup)
|
|||||||
static PyObject *
|
static PyObject *
|
||||||
PLyBool_FromBool(PLyDatumToOb *arg, Datum d)
|
PLyBool_FromBool(PLyDatumToOb *arg, Datum d)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
|
||||||
|
* generating SQL from trigger functions, but those are only supported in
|
||||||
|
* Python >= 2.4, and we support older versions.
|
||||||
|
* http://docs.python.org/api/boolObjects.html
|
||||||
|
*/
|
||||||
if (DatumGetBool(d))
|
if (DatumGetBool(d))
|
||||||
Py_RETURN_TRUE;
|
return PyBool_FromLong(1);
|
||||||
Py_RETURN_FALSE;
|
return PyBool_FromLong(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
Reference in New Issue
Block a user