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)
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