PL/Python: Remove workaround for returning booleans in Python <2.3
authorPeter Eisentraut
Sat, 29 Sep 2012 16:55:42 +0000 (12:55 -0400)
committerPeter Eisentraut
Sat, 29 Sep 2012 16:55:42 +0000 (12:55 -0400)
Since Python 2.2 is no longer supported, we can now use Py_RETURN_TRUE
and Py_RETURN_FALSE instead of the old workaround.

src/pl/plpython/plpy_typeio.c

index 0ad542f21e96fdbc19fb8500d20d05dd91e3ba73..74da5180f1b8e40da653b003ded6af73ddde8398 100644 (file)
@@ -492,15 +492,9 @@ PLy_input_datum_func2(PLyDatumToOb *arg, Oid typeOid, HeapTuple typeTup)
 static PyObject *
 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.3, and we support older versions.
-    * http://docs.python.org/api/boolObjects.html
-    */
    if (DatumGetBool(d))
-       return PyBool_FromLong(1);
-   return PyBool_FromLong(0);
+       Py_RETURN_TRUE;
+   Py_RETURN_FALSE;
 }
 
 static PyObject *