Skip to content

Conversation

@prithviraj-chaudhuri
Copy link
Contributor

@prithviraj-chaudhuri prithviraj-chaudhuri commented Nov 18, 2025

This commit addresses this issue #140042 (comment).
It removes the sqlite3_shutdown call that could cause closing connections for sqlite when used with multiple sub interpreters.

@python-cla-bot
Copy link

python-cla-bot bot commented Nov 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Nov 18, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

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

Thank you.

I don't see a good way to add a test here -- we'd need to inject a failure in the module initialization logic, and then watch undefined behaviour.

If we want to clean up properly, we should call sqlite3_shutdown in e.g. module_free. That's not the case here -- sqlite3 leaks in the “happy” path. Also leaking on error isn't a big issue.

(Presumably we leak a fixed amount of resources per process, so adding proper calls to sqlite3_shutdown isn't a big priority.)

@erlend-aasland, do you want to take a look?
I'll merge around Thursday if there are no objections.

@encukou encukou added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 20, 2025
@encukou encukou merged commit b1558b6 into python:main Nov 20, 2025
54 checks passed
@miss-islington-app
Copy link

Thanks @prithviraj-chaudhuri for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 20, 2025
…41690)

(cherry picked from commit b1558b6)

Co-authored-by: Prithviraj Chaudhuri <p.chaudhuri1993@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Nov 20, 2025

GH-141793 is a backport of this pull request to the 3.14 branch.

@miss-islington-app
Copy link

Sorry, @prithviraj-chaudhuri and @encukou, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker b1558b6d3e2af8964840a5c00356533107368f22 3.13

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Nov 20, 2025
@hugovk hugovk removed the needs backport to 3.13 bugs and security fixes label Nov 21, 2025
hugovk pushed a commit that referenced this pull request Nov 30, 2025
#141793)

Co-authored-by: Prithviraj Chaudhuri <p.chaudhuri1993@gmail.com>
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
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.

3 participants