Skip to content

[3.15] gh-159739: Keep SQLite list parameters alive while binding (GH-160192) - #160361

Merged
JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-4df47d8-3.15
Oct 22, 2026
Merged

JelleZijlstra merged 1 commit into
python:3.15from
miss-islington:backport-4df47d8-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

When a SQL parameter sequence is an exact list, sqlite3 retrieved an element as a borrowed reference before taking ownership. On free-threaded builds another thread can replace it in between, so binding can use a freed object and crash. Fetch a strong reference atomically. Backport to 3.15 and 3.14.
(cherry picked from commit 4df47d8)

Co-authored-by: Jelle Zijlstra jelle@openai.com

…honGH-160192)

When a SQL parameter sequence is an exact list, sqlite3 retrieved an element as a borrowed reference before taking ownership. On free-threaded builds another thread can replace it in between, so binding can use a freed object and crash. Fetch a strong reference atomically. Backport to 3.15 and 3.14.
(cherry picked from commit 4df47d8)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
@JelleZijlstra
JelleZijlstra enabled auto-merge (squash) October 22, 2026 22:22
@JelleZijlstra
JelleZijlstra merged commit 7291b84 into python:3.15 Oct 22, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-4df47d8-3.15 branch October 22, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants