Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e938e3

Browse files
committed
Revert "PL/Python: Remove workaround for returning booleans in Python <2.3"
This reverts commitbe0dfba.The previous information that Py_RETURN_TRUE and Py_RETURN_FALSE aresupported in Python 2.3 is wrong. They require Python 2.4. Update thecomment about that.
1 parent9e6df60 commit7e938e3

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
staticPyObject*
493493
PLyBool_FromBool(PLyDatumToOb*arg,Datumd)
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+
returnPyBool_FromLong(1);
503+
returnPyBool_FromLong(0);
498504
}
499505

500506
staticPyObject*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp