Skip to content

Commit be0dfba

Browse files
committed
PL/Python: Remove workaround for returning booleans in Python <2.3
Since Python 2.2 is no longer supported, we can now use Py_RETURN_TRUE and Py_RETURN_FALSE instead of the old workaround.
1 parent db0af74 commit be0dfba

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/pl/plpython/plpy_typeio.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,9 @@ PLy_input_datum_func2(PLyDatumToOb *arg, Oid typeOid, HeapTuple typeTup)
492492
static PyObject *
493493
PLyBool_FromBool(PLyDatumToOb *arg, Datum d)
494494
{
495-
/*
496-
* We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
497-
* generating SQL from trigger functions, but those are only supported in
498-
* Python >= 2.3, and we support older versions.
499-
* http://docs.python.org/api/boolObjects.html
500-
*/
501495
if (DatumGetBool(d))
502-
return PyBool_FromLong(1);
503-
return PyBool_FromLong(0);
496+
Py_RETURN_TRUE;
497+
Py_RETURN_FALSE;
504498
}
505499

506500
static PyObject *

0 commit comments

Comments
 (0)