Content-Length: 274254 | pFad | http://github.com/postgrespro/postgres/commit/7e938e3c56590899bcfa587ad0220869cb9be951

A5 Revert "PL/Python: Remove workaround for returning booleans in Python… · postgrespro/postgres@7e938e3 · GitHub
Skip to content

Commit 7e938e3

Browse files
committed
Revert "PL/Python: Remove workaround for returning booleans in Python <2.3"
This reverts commit be0dfba. 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.
1 parent 9e6df60 commit 7e938e3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pl/plpython/plpy_typeio.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,15 @@ 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.4, and we support older versions.
499+
* http://docs.python.org/api/boolObjects.html
500+
*/
495501
if (DatumGetBool(d))
496-
Py_RETURN_TRUE;
497-
Py_RETURN_FALSE;
502+
return PyBool_FromLong(1);
503+
return PyBool_FromLong(0);
498504
}
499505

500506
static PyObject *

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/7e938e3c56590899bcfa587ad0220869cb9be951

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy