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

Commitbfe8b89

Browse files
committed
Allow pl/pythonu >= version 2.3 to return boolean, rather than 1/0.
Marko Kreen
1 parent749167c commitbfe8b89

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎src/pl/plpython/plpython.c

Lines changed: 11 additions & 3 deletions
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.98 2007/04/0313:37:22 momjian Exp $
4+
*$PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.99 2007/04/0315:50:58 momjian Exp $
55
*
66
*********************************************************************
77
*/
@@ -32,6 +32,14 @@ typedef int Py_ssize_t;
3232
#definePY_SSIZE_T_MIN INT_MIN
3333
#endif
3434

35+
/*
36+
* PyBool_FromLong is supported from 2.3.
37+
*/
38+
#ifPY_VERSION_HEX<0x02030000
39+
#definePyBool_FromLong(x) PyInt_FromLong(x)
40+
#endif
41+
42+
3543
#include"postgres.h"
3644

3745
/* system stuff */
@@ -1600,8 +1608,8 @@ PLyBool_FromString(const char *src)
16001608
*versions. http://docs.python.org/api/boolObjects.html
16011609
*/
16021610
if (src[0]=='t')
1603-
returnPyInt_FromLong(1);
1604-
returnPyInt_FromLong(0);
1611+
returnPyBool_FromLong(1);
1612+
returnPyBool_FromLong(0);
16051613
}
16061614

16071615
staticPyObject*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp