Skip to content
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

gh-95656: Enable the sqlite3 load extension API in Windows build #95662

Merged

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented Aug 4, 2022

@erlend-aasland erlend-aasland requested a review from a team as a code owner August 4, 2022 16:49
@erlend-aasland erlend-aasland linked an issue Aug 4, 2022 that may be closed by this pull request
@erlend-aasland
Copy link
Contributor Author

I'm not sure about backporting this. What do you say, Steve?

@erlend-aasland
Copy link
Contributor Author

This API is not tested. Let's add a test while we're there.

@zooba
Copy link
Member

zooba commented Aug 4, 2022

Does this have a Python API to go with it? Is that currently unusable on every release? If so, let's backport.

@erlend-aasland
Copy link
Contributor Author

Does this have a Python API to go with it?

Yes, it enables this API:

#ifdef PY_SQLITE_ENABLE_LOAD_EXTENSION
/*[clinic input]
_sqlite3.Connection.enable_load_extension as pysqlite_connection_enable_load_extension
enable as onoff: bool(accept={int})
/
Enable dynamic loading of SQLite extension modules.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_enable_load_extension_impl(pysqlite_Connection *self,
int onoff)
/*[clinic end generated code: output=9cac37190d388baf input=5f00e93f7a9d3540]*/
{
int rc;
if (PySys_Audit("sqlite3.enable_load_extension",
"OO", self, onoff ? Py_True : Py_False) < 0) {
return NULL;
}
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
}
rc = sqlite3_enable_load_extension(self->db, onoff);
if (rc != SQLITE_OK) {
PyErr_SetString(self->OperationalError,
"Error enabling load extension");
return NULL;
} else {
Py_RETURN_NONE;
}
}

Is that currently unusable on every release? If so, let's backport.

Yes; ok.

@erlend-aasland erlend-aasland added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Aug 4, 2022
@zooba
Copy link
Member

zooba commented Aug 4, 2022

Haha, yeah, good point. Backport for sure

@erlend-aasland
Copy link
Contributor Author

Thanks, Steve!

@erlend-aasland erlend-aasland merged commit 6a5104f into python:main Aug 4, 2022
@miss-islington
Copy link
Contributor

Thanks @erlend-aasland for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@erlend-aasland erlend-aasland deleted the sqlite-ext-loading-on-windows branch August 4, 2022 19:26
@miss-islington
Copy link
Contributor

Sorry, @erlend-aasland, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 6a5104f4fa83ed08fe31f712757dddabfede394c 3.10

@bedevere-bot
Copy link

GH-95671 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Aug 4, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 4, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Aug 4, 2022
…ws build (pythonGH-95662).

(cherry picked from commit 6a5104f)

Co-authored-by: Erlend Egeberg Aasland <[email protected]>
@erlend-aasland erlend-aasland removed the needs backport to 3.10 only security fixes label Aug 4, 2022
@erlend-aasland
Copy link
Contributor Author

erlend-aasland commented Aug 4, 2022

Aha... no backport to 3.10 is needed. I changed the #ifdef guard in 3.11, while Christian and I were updating configure.ac. So... this means I broke this for Windows builds in 3.11.

FTR, broken in gh-29434.

miss-islington added a commit that referenced this pull request Aug 4, 2022
…95662)

(cherry picked from commit 6a5104f)

Co-authored-by: Erlend Egeberg Aasland <[email protected]>
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Aug 11, 2022
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.

Enable sqlite extensions in the Windows build
4 participants