summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/statement.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2022-01-26 16:26:16 (GMT)
committerGitHub <noreply@github.com>2022-01-26 16:26:16 (GMT)
commit3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b (patch)
treee1de53467a3eb82edefb4be889c9cca4ff820da1 /Modules/_sqlite/statement.c
parentac0c6e128cb6553585af096c851c488b53a6c952 (diff)
downloadcpython-3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b.zip
cpython-3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b.tar.gz
cpython-3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b.tar.bz2
bpo-43853: Expand test suite for SQLite UDF's (GH-27642)
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r--Modules/_sqlite/statement.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 66fadb6..6885b50 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -166,9 +166,16 @@ int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObjec
rc = sqlite3_bind_int64(self->st, pos, value);
break;
}
- case TYPE_FLOAT:
- rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
+ case TYPE_FLOAT: {
+ double value = PyFloat_AsDouble(parameter);
+ if (value == -1 && PyErr_Occurred()) {
+ rc = -1;
+ }
+ else {
+ rc = sqlite3_bind_double(self->st, pos, value);
+ }
break;
+ }
case TYPE_UNICODE:
string = PyUnicode_AsUTF8AndSize(parameter, &buflen);
if (string == NULL)