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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy