diff options
author | Erlend Egeberg Aasland <erlend.aasland@innova.no> | 2022-03-02 04:46:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-02 04:46:16 (GMT) |
commit | 3ea2a8f425d26e81d914c54d477e9d56eb27ac98 (patch) | |
tree | 15e3bd5417f3ee11c976a6eaca59bc4628785c9f /Modules/_sqlite/statement.c | |
parent | 7190617b562eae44e961dd6cc8c3c139b48af303 (diff) | |
download | cpython-3ea2a8f425d26e81d914c54d477e9d56eb27ac98.zip cpython-3ea2a8f425d26e81d914c54d477e9d56eb27ac98.tar.gz cpython-3ea2a8f425d26e81d914c54d477e9d56eb27ac98.tar.bz2 |
[3.9] bpo-43853: Expand test suite for SQLite UDF's (GH-27642) (GH-31030) (GH-31586)
(cherry picked from commit 3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b)
Diffstat (limited to 'Modules/_sqlite/statement.c')
-rw-r--r-- | Modules/_sqlite/statement.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c index 23c204e..0272ce1 100644 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -152,9 +152,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) |