Skip to content

Commit 97ca005

Browse files
committed
gh-142787: Fix assertion failure in sqlite3 blob slice
1 parent 1cc7551 commit 97ca005

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix assertion failure in :mod:`sqlite3` blob subscript when slicing with
2+
indices that result in an empty slice.

Modules/_sqlite/blob.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ subscript_slice(pysqlite_Blob *self, PyObject *item)
439439
return NULL;
440440
}
441441

442+
if (len == 0) {
443+
return PyBytes_FromStringAndSize(NULL, 0);
444+
}
445+
442446
if (step == 1) {
443447
return read_multiple(self, len, start);
444448
}

0 commit comments

Comments
 (0)