Skip to content

gh-155702: Fix sqlite3.Blob slice assignment with a step - #155703

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-155702-blob-singleton-corruption
Open

gh-155702: Fix sqlite3.Blob slice assignment with a step#155703
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:gh-155702-blob-singleton-corruption

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 13, 2026

Copy link
Copy Markdown
Member

ass_subscript_slice() patched the bytes object read from the blob and wrote it back.
For a single byte that object is an immortal singleton, so the value of that byte was changed in the whole process.

It now reads into a plain buffer.
The raw read is factored out of read_multiple() into inner_read(), like the existing inner_write().

The negative step case (gh-150449, GH-150450) still raises the same ValueError as before.

It patched the bytes object read from the blob, which for a single byte
is an immortal singleton, so that the value of that byte was changed in
the whole process.

Read into a plain buffer instead.  The raw read is factored out of
read_multiple() into inner_read().

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants