Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0626a7d

Browse files
committed
Reverse out use of Py_RETURN_TRUE in plpython, only supported in Python >=
2.3.
1 parent 22bd156 commit 0626a7d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pl/plpython/plpython.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plpython.c - python as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.91 2007/01/25 04:08:51 momjian Exp $
4+
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.92 2007/01/25 14:52:23 momjian Exp $
55
*
66
*********************************************************************
77
*/
@@ -1579,9 +1579,15 @@ PLy_typeinfo_dealloc(PLyTypeInfo * arg)
15791579
static PyObject *
15801580
PLyBool_FromString(const char *src)
15811581
{
1582+
/*
1583+
* We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for
1584+
* generating SQL from trigger functions, but those are only
1585+
* supported in Python >= 2.3, and we support older
1586+
* versions. http://docs.python.org/api/boolObjects.html
1587+
*/
15821588
if (src[0] == 't')
1583-
Py_RETURN_TRUE;
1584-
Py_RETURN_FALSE;
1589+
return PyInt_FromLong(1);
1590+
return PyInt_FromLong(0);
15851591
}
15861592

15871593
static PyObject *

0 commit comments

Comments
 (0)