-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-31746: Prevent segfaults with uninitialised sqlite3.Connection
objects
#27431
bpo-31746: Prevent segfaults with uninitialised sqlite3.Connection
objects
#27431
Conversation
if (!self->initialized) { | ||
pysqlite_state *state = pysqlite_get_state(NULL); | ||
PyErr_SetString(state->ProgrammingError, | ||
"Base Connection.__init__ not called."); | ||
return NULL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use pysqlite_check_connection
here, since it also checks self->db
. Calling close()
twice should still be a no-op.
Backport to 3.9 as well? |
Thanks @erlend-aasland for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
Sorry, @erlend-aasland and @pablogsal, I could not cleanly backport this to |
Thanks @erlend-aasland for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry @erlend-aasland and @pablogsal, I had trouble checking out the |
Oh, seems that the backport party crashed :( @erlend-aasland can you do them manually? |
Yes, I was expecting it to fail. I'll fix it right away. Should we backport to 3.9 as well? |
@erlend-aasland apparently we have a buildbot failure: https://buildbot.python.org/all/#/builders/596/builds/703/ We may need to revert this meanwhile we understand what failed |
…alised (pythonGH-27431). (cherry picked from commit 7e311e4) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
Yes, please revert it. |
GH-27465 is a backport of this pull request to the 3.9 branch. |
…alised (GH-27431) (GH-27465) (cherry picked from commit 7e311e4) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
We are missing the 3.10 backport still |
Doh, I'll get to it after morning coffee :) |
…ialised (pythonGH-27431). (cherry picked from commit 7e311e4) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
GH-27472 is a backport of this pull request to the 3.10 branch. |
Sync with main bco. pythonGH-27431
…ialised (GH-27431). (GH-27472) (cherry picked from commit 7e311e4) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
sqlite3.Connection.initialized
when the connection objectis initialised
close()
isolation_level
[1] This may happen during connection init, so we cannot use
pysqlite_connection_commit
, since it requires an initialisedconnection object. Previously, this was not a problem, since the
initialised flag was incorrectly set before the connection object was
initialised.
https://bugs.python.org/issue31746