Skip to content

[3.14] gh-150449: Raise ValueError for sqlite3.Blob slices with a negative step (GH-155773) - #159110

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-503560d-3.14
Oct 10, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-503560d-3.14

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Reading or writing such a slice computed a negative length and failed with SystemError. Empty slices, which select nothing, are still allowed.

(cherry picked from commit 503560d)

Backported from 3.15 (GH-155773), not from the main branch: the change on the main branch is GH-150450, which adds support for negative steps.

Modules/_sqlite/blob.c and the NEWS entry applied cleanly. The only conflict was in Lib/test/test_sqlite3/test_dbapi.py, because test_blob_set_slice_with_step_keeps_bytes_intact(), which follows the new test on 3.15, does not exist on 3.14. The new test is added in the same place, right after test_blob_set_slice().

… a negative step (pythonGH-155773)

Reading or writing such a slice computed a negative length and failed with
SystemError.  Empty slices, which select nothing, are still allowed.
(cherry picked from commit 503560d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit d9e8d226a3d05ea020256086aee24d21f9792206)
@bedevere-app bedevere-app Bot added the type-feature A feature request or enhancement label Oct 10, 2026
@serhiy-storchaka serhiy-storchaka removed the type-feature A feature request or enhancement label Oct 10, 2026
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) October 10, 2026 11:17
@serhiy-storchaka
serhiy-storchaka merged commit 15045f4 into python:3.14 Oct 10, 2026
52 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant