aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index dbe5dd1ec13..370dc1a30e4 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1772,7 +1772,11 @@ pysqlite_connection_create_collation_impl(pysqlite_Connection *self,
(callable != Py_None) ? callable : NULL,
(callable != Py_None) ? pysqlite_collation_callback : NULL);
if (rc != SQLITE_OK) {
- PyDict_DelItem(self->collations, uppercase_name);
+ if (callable != Py_None) {
+ if (PyDict_DelItem(self->collations, uppercase_name) < 0) {
+ PyErr_Clear();
+ }
+ }
_pysqlite_seterror(self->db, NULL);
goto finally;
}