From 6fc91240c9ea8a9a8cc37e0c78854698d0e07d00 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 12 Apr 2023 12:21:27 +0200 Subject: [PATCH 1/6] gh-103489: Add get/set config methods to sqlite3.Connection --- Doc/library/sqlite3.rst | 53 ++++++++ Doc/whatsnew/3.12.rst | 5 + Lib/test/test_sqlite3/test_dbapi.py | 15 +++ ...-04-13-13-17-47.gh-issue-103489.ZSZgmu.rst | 4 + Modules/_sqlite/clinic/connection.c.h | 77 +++++++++++- Modules/_sqlite/connection.c | 115 ++++++++++++++++++ Modules/_sqlite/module.c | 43 +++++++ 7 files changed, 311 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2023-04-13-13-17-47.gh-issue-103489.ZSZgmu.rst diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 51146e00999659..aa1964e162b737 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -573,6 +573,35 @@ Module constants package, a third-party library which used to upstream changes to :mod:`!sqlite3`. Today, it carries no meaning or practical value. +.. _sqlite3-dbconfig-constants + +.. data:: SQLITE_DBCONFIG_DEFENSIVE + SQLITE_DBCONFIG_DQS_DDL + SQLITE_DBCONFIG_DQS_DML + SQLITE_DBCONFIG_ENABLE_FKEY + SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER + SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION + SQLITE_DBCONFIG_ENABLE_QPSG + SQLITE_DBCONFIG_ENABLE_TRIGGER + SQLITE_DBCONFIG_ENABLE_VIEW + SQLITE_DBCONFIG_LEGACY_ALTER_TABLE + SQLITE_DBCONFIG_LEGACY_FILE_FORMAT + SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE + SQLITE_DBCONFIG_RESET_DATABASE + SQLITE_DBCONFIG_TRIGGER_EQP + SQLITE_DBCONFIG_TRUSTED_SCHEMA + SQLITE_DBCONFIG_WRITABLE_SCHEMA + + These constants are used for the :meth:`Connection.setconfig` + and :meth:`~Connection.getconfig` methods. + + ..versionadded:: 3.12 + + ..seealso:: + + https://www.sqlite.org/c3ref/c_dbconfig_defensive.html + SQLite docs: Database Connection Configuration Options + .. _sqlite3-connection-objects: @@ -1201,6 +1230,30 @@ Connection objects .. _SQLite limit category: https://www.sqlite.org/c3ref/c_limit_attached.html + .. method:: getconfig(op, /) + + Query a boolean connection configuration option. + + :param int op: + A :ref:`SQLITE_DBCONFIG code `. + + :rtype: bool + + .. versionadded:: 3.12 + + .. method:: setconfig(op, enable, /) + + Set a boolean connection configuration option. + + :param int op: + A :ref:`SQLITE_DBCONFIG code `. + + :param bool enable: + ``True`` if the configuration option should be enabled; + ``False`` if it should be disabled. + + .. versionadded:: 3.12 + .. method:: serialize(*, name="main") Serialize a database into a :class:`bytes` object. For an diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index c7fc7d229cd753..ef981a7272579d 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -384,6 +384,11 @@ sqlite3 :ref:`transaction handling `. (Contributed by Erlend E. Aasland in :gh:`83638`.) +* Add :meth:`~sqlite3.Connection.getconfig` and + :meth:`~sqlite3.Connection.setconfig` to :class:`~sqlite3.Connection` + to make configuration changes to a database connection. + (Contributed by Erlend E. Aasland in :gh:`103489`.) + threading --------- diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 3013abfa730ed5..b0417797ec34b8 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -577,6 +577,21 @@ def test_connection_bad_reinit(self): cx.executemany, "insert into t values(?)", ((v,) for v in range(3))) + def test_connection_config(self): + op = sqlite.SQLITE_DBCONFIG_ENABLE_FKEY + with memory_database() as cx: + with self.assertRaisesRegex(ValueError, "unknown"): + cx.getconfig(-1) + + old = cx.getconfig(op) + new = not old + + cx.setconfig(op, new) + self.assertEqual(cx.getconfig(op), new) + + cx.setconfig(op, old) + self.assertEqual(cx.getconfig(op), old) + class UninitialisedConnectionTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS.d/next/Library/2023-04-13-13-17-47.gh-issue-103489.ZSZgmu.rst b/Misc/NEWS.d/next/Library/2023-04-13-13-17-47.gh-issue-103489.ZSZgmu.rst new file mode 100644 index 00000000000000..264564d018ceb4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-04-13-13-17-47.gh-issue-103489.ZSZgmu.rst @@ -0,0 +1,4 @@ +Add :meth:`~sqlite3.Connection.getconfig` and +:meth:`~sqlite3.Connection.setconfig` to :class:`~sqlite3.Connection` to +make configuration changes to a database connection. Patch by Erlend E. +Aasland. diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h index 4c3fd1bd27411b..a309fb9fed8c40 100644 --- a/Modules/_sqlite/clinic/connection.c.h +++ b/Modules/_sqlite/clinic/connection.c.h @@ -1513,6 +1513,81 @@ getlimit(pysqlite_Connection *self, PyObject *arg) return return_value; } +PyDoc_STRVAR(setconfig__doc__, +"setconfig($self, op, enable, /)\n" +"--\n" +"\n" +"\n" +"\n" +" op\n" +" The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); + +#define SETCONFIG_METHODDEF \ + {"setconfig", _PyCFunction_CAST(setconfig), METH_FASTCALL, setconfig__doc__}, + +static PyObject * +setconfig_impl(pysqlite_Connection *self, int op, int enable); + +static PyObject * +setconfig(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs) +{ + PyObject *return_value = NULL; + int op; + int enable; + + if (!_PyArg_CheckPositional("setconfig", nargs, 2, 2)) { + goto exit; + } + op = _PyLong_AsInt(args[0]); + if (op == -1 && PyErr_Occurred()) { + goto exit; + } + enable = PyObject_IsTrue(args[1]); + if (enable < 0) { + goto exit; + } + return_value = setconfig_impl(self, op, enable); + +exit: + return return_value; +} + +PyDoc_STRVAR(getconfig__doc__, +"getconfig($self, op, /)\n" +"--\n" +"\n" +"\n" +"\n" +" op\n" +" The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); + +#define GETCONFIG_METHODDEF \ + {"getconfig", (PyCFunction)getconfig, METH_O, getconfig__doc__}, + +static int +getconfig_impl(pysqlite_Connection *self, int op); + +static PyObject * +getconfig(pysqlite_Connection *self, PyObject *arg) +{ + PyObject *return_value = NULL; + int op; + int _return_value; + + op = _PyLong_AsInt(arg); + if (op == -1 && PyErr_Occurred()) { + goto exit; + } + _return_value = getconfig_impl(self, op); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + #ifndef CREATE_WINDOW_FUNCTION_METHODDEF #define CREATE_WINDOW_FUNCTION_METHODDEF #endif /* !defined(CREATE_WINDOW_FUNCTION_METHODDEF) */ @@ -1532,4 +1607,4 @@ getlimit(pysqlite_Connection *self, PyObject *arg) #ifndef DESERIALIZE_METHODDEF #define DESERIALIZE_METHODDEF #endif /* !defined(DESERIALIZE_METHODDEF) */ -/*[clinic end generated code: output=f10306e10427488b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e4a5908ca25f1741 input=a9049054013a1b77]*/ diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index fb61ef82ef869b..a3ba210789ea9f 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -30,6 +30,8 @@ #include "prepare_protocol.h" #include "util.h" +#include + #if SQLITE_VERSION_NUMBER >= 3014000 #define HAVE_TRACE_V2 #endif @@ -2340,6 +2342,117 @@ getlimit_impl(pysqlite_Connection *self, int category) return setlimit_impl(self, category, -1); } +static inline bool +is_int_config(const int op) +{ + switch (op) { + case SQLITE_DBCONFIG_ENABLE_FKEY: + case SQLITE_DBCONFIG_ENABLE_TRIGGER: +#if SQLITE_VERSION_NUMBER >= 3012002 + case SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: +#endif +#if SQLITE_VERSION_NUMBER >= 3013000 + case SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: +#endif +#if SQLITE_VERSION_NUMBER >= 3016000 + case SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: +#endif +#if SQLITE_VERSION_NUMBER >= 3020000 + case SQLITE_DBCONFIG_ENABLE_QPSG: +#endif +#if SQLITE_VERSION_NUMBER >= 3022000 + case SQLITE_DBCONFIG_TRIGGER_EQP: +#endif +#if SQLITE_VERSION_NUMBER >= 3024000 + case SQLITE_DBCONFIG_RESET_DATABASE: +#endif +#if SQLITE_VERSION_NUMBER >= 3026000 + case SQLITE_DBCONFIG_DEFENSIVE: +#endif +#if SQLITE_VERSION_NUMBER >= 3028000 + case SQLITE_DBCONFIG_WRITABLE_SCHEMA: +#endif +#if SQLITE_VERSION_NUMBER >= 3029000 + case SQLITE_DBCONFIG_DQS_DDL: + case SQLITE_DBCONFIG_DQS_DML: + case SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: +#endif +#if SQLITE_VERSION_NUMBER >= 3030000 + case SQLITE_DBCONFIG_ENABLE_VIEW: +#endif +#if SQLITE_VERSION_NUMBER >= 3031000 + case SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: + case SQLITE_DBCONFIG_TRUSTED_SCHEMA: +#endif + return true; + default: + return false; + } +} + +/*[clinic input] +_sqlite3.Connection.setconfig as setconfig + + op: int + The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes. + enable: bool + / + +[clinic start generated code]*/ + +static PyObject * +setconfig_impl(pysqlite_Connection *self, int op, int enable) +/*[clinic end generated code: output=c60b13e618aff873 input=523e31c0dc82f243]*/ +{ + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return NULL; + } + if (!is_int_config(op)) { + return PyErr_Format(PyExc_ValueError, "unknown config 'op': %d", op); + } + + int actual; + int rc = sqlite3_db_config(self->db, op, enable, &actual); + if (rc != SQLITE_OK) { + (void)_pysqlite_seterror(self->state, self->db); + return NULL; + } + if (enable != actual) { + PyErr_SetString(self->state->OperationalError, "Unable to set config"); + return NULL; + } + Py_RETURN_NONE; +} + +/*[clinic input] +_sqlite3.Connection.getconfig as getconfig -> bool + + op: int + The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes. + / + +[clinic start generated code]*/ + +static int +getconfig_impl(pysqlite_Connection *self, int op) +/*[clinic end generated code: output=25ac05044c7b78a3 input=667d2ef05fff2f61]*/ +{ + if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { + return -1; + } + if (!is_int_config(op)) { + PyErr_Format(PyExc_ValueError, "unknown config 'op': %d", op); + return -1; + } + + int current; + int rc = sqlite3_db_config(self->db, op, -1, ¤t); + if (rc != SQLITE_OK) { + (void)_pysqlite_seterror(self->state, self->db); + return -1; + } + return current; +} static PyObject * get_autocommit(pysqlite_Connection *self, void *Py_UNUSED(ctx)) @@ -2421,6 +2534,8 @@ static PyMethodDef connection_methods[] = { DESERIALIZE_METHODDEF CREATE_WINDOW_FUNCTION_METHODDEF BLOBOPEN_METHODDEF + SETCONFIG_METHODDEF + GETCONFIG_METHODDEF {NULL, NULL} }; diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index 6db3d51fd20220..9c42faa232c70d 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -499,6 +499,49 @@ add_integer_constants(PyObject *module) { #if SQLITE_VERSION_NUMBER >= 3008007 ADD_INT(SQLITE_LIMIT_WORKER_THREADS); #endif + + /* + * Database connection configuration options. + * See https://www.sqlite.org/c3ref/c_dbconfig_defensive.html + */ + ADD_INT(SQLITE_DBCONFIG_ENABLE_FKEY); + ADD_INT(SQLITE_DBCONFIG_ENABLE_TRIGGER); +#if SQLITE_VERSION_NUMBER >= 3012002 + ADD_INT(SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER); +#endif +#if SQLITE_VERSION_NUMBER >= 3013000 + ADD_INT(SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION); +#endif +#if SQLITE_VERSION_NUMBER >= 3016000 + ADD_INT(SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE); +#endif +#if SQLITE_VERSION_NUMBER >= 3020000 + ADD_INT(SQLITE_DBCONFIG_ENABLE_QPSG); +#endif +#if SQLITE_VERSION_NUMBER >= 3022000 + ADD_INT(SQLITE_DBCONFIG_TRIGGER_EQP); +#endif +#if SQLITE_VERSION_NUMBER >= 3024000 + ADD_INT(SQLITE_DBCONFIG_RESET_DATABASE); +#endif +#if SQLITE_VERSION_NUMBER >= 3026000 + ADD_INT(SQLITE_DBCONFIG_DEFENSIVE); +#endif +#if SQLITE_VERSION_NUMBER >= 3028000 + ADD_INT(SQLITE_DBCONFIG_WRITABLE_SCHEMA); +#endif +#if SQLITE_VERSION_NUMBER >= 3029000 + ADD_INT(SQLITE_DBCONFIG_DQS_DDL); + ADD_INT(SQLITE_DBCONFIG_DQS_DML); + ADD_INT(SQLITE_DBCONFIG_LEGACY_ALTER_TABLE); +#endif +#if SQLITE_VERSION_NUMBER >= 3030000 + ADD_INT(SQLITE_DBCONFIG_ENABLE_VIEW); +#endif +#if SQLITE_VERSION_NUMBER >= 3031000 + ADD_INT(SQLITE_DBCONFIG_LEGACY_FILE_FORMAT); + ADD_INT(SQLITE_DBCONFIG_TRUSTED_SCHEMA); +#endif #undef ADD_INT return 0; } From c33b28811d1c43a17b625dd91b586dd41d03eab8 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 13 Apr 2023 13:51:44 +0200 Subject: [PATCH 2/6] Sphinx syntax err --- Doc/library/sqlite3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index aa1964e162b737..9cd4f2edce80ac 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -573,7 +573,7 @@ Module constants package, a third-party library which used to upstream changes to :mod:`!sqlite3`. Today, it carries no meaning or practical value. -.. _sqlite3-dbconfig-constants +.. _sqlite3-dbconfig-constants: .. data:: SQLITE_DBCONFIG_DEFENSIVE SQLITE_DBCONFIG_DQS_DDL From 7195bccb01101547f094ba3807acfe9f9cdc2c6b Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 13 Apr 2023 14:26:24 +0200 Subject: [PATCH 3/6] Default to enabling the config option --- Doc/library/sqlite3.rst | 4 ++-- Lib/test/test_sqlite3/test_dbapi.py | 15 ++++++++++++--- Modules/_sqlite/clinic/connection.c.h | 12 ++++++++---- Modules/_sqlite/connection.c | 4 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 9cd4f2edce80ac..bf68e0902e9b97 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1241,7 +1241,7 @@ Connection objects .. versionadded:: 3.12 - .. method:: setconfig(op, enable, /) + .. method:: setconfig(op, enable=True, /) Set a boolean connection configuration option. @@ -1249,7 +1249,7 @@ Connection objects A :ref:`SQLITE_DBCONFIG code `. :param bool enable: - ``True`` if the configuration option should be enabled; + ``True`` if the configuration option should be enabled (default); ``False`` if it should be disabled. .. versionadded:: 3.12 diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index b0417797ec34b8..1bb0e13e356e78 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -583,14 +583,23 @@ def test_connection_config(self): with self.assertRaisesRegex(ValueError, "unknown"): cx.getconfig(-1) + # Toggle and verify. old = cx.getconfig(op) new = not old - cx.setconfig(op, new) self.assertEqual(cx.getconfig(op), new) - cx.setconfig(op, old) - self.assertEqual(cx.getconfig(op), old) + cx.setconfig(op) # defaults to True + self.assertTrue(cx.getconfig(op)) + + # Check that foreign key support was actually enabled. + with cx: + cx.executescript(""" + create table t(t integer primary key); + create table u(u, foreign key(u) references t(t)); + """) + with self.assertRaisesRegex(sqlite.IntegrityError, "constraint"): + cx.execute("insert into u values(0)") class UninitialisedConnectionTests(unittest.TestCase): diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h index a309fb9fed8c40..3417d1f0519276 100644 --- a/Modules/_sqlite/clinic/connection.c.h +++ b/Modules/_sqlite/clinic/connection.c.h @@ -1514,7 +1514,7 @@ getlimit(pysqlite_Connection *self, PyObject *arg) } PyDoc_STRVAR(setconfig__doc__, -"setconfig($self, op, enable, /)\n" +"setconfig($self, op, enable=True, /)\n" "--\n" "\n" "\n" @@ -1533,19 +1533,23 @@ setconfig(pysqlite_Connection *self, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; int op; - int enable; + int enable = 1; - if (!_PyArg_CheckPositional("setconfig", nargs, 2, 2)) { + if (!_PyArg_CheckPositional("setconfig", nargs, 1, 2)) { goto exit; } op = _PyLong_AsInt(args[0]); if (op == -1 && PyErr_Occurred()) { goto exit; } + if (nargs < 2) { + goto skip_optional; + } enable = PyObject_IsTrue(args[1]); if (enable < 0) { goto exit; } +skip_optional: return_value = setconfig_impl(self, op, enable); exit: @@ -1607,4 +1611,4 @@ getconfig(pysqlite_Connection *self, PyObject *arg) #ifndef DESERIALIZE_METHODDEF #define DESERIALIZE_METHODDEF #endif /* !defined(DESERIALIZE_METHODDEF) */ -/*[clinic end generated code: output=e4a5908ca25f1741 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=84560376421204ce input=a9049054013a1b77]*/ diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index a3ba210789ea9f..fe2f64d7b67d57 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -2395,14 +2395,14 @@ _sqlite3.Connection.setconfig as setconfig op: int The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes. - enable: bool + enable: bool = True / [clinic start generated code]*/ static PyObject * setconfig_impl(pysqlite_Connection *self, int op, int enable) -/*[clinic end generated code: output=c60b13e618aff873 input=523e31c0dc82f243]*/ +/*[clinic end generated code: output=c60b13e618aff873 input=01d77271ea8ca45f]*/ { if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; From 06e925c751599517294ffe1c57ffc2d32fb345e8 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 24 Apr 2023 14:17:24 +0200 Subject: [PATCH 4/6] Add a sentence about the availability of the new constants --- Doc/library/sqlite3.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index bf68e0902e9b97..7328c08aef4d14 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -595,6 +595,9 @@ Module constants These constants are used for the :meth:`Connection.setconfig` and :meth:`~Connection.getconfig` methods. + The availability of these constants vary depending on the version of SQLite + Python was compiled with. + ..versionadded:: 3.12 ..seealso:: From 3116c3781c3f87fe76177c9695520be6fd31e9bd Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 25 Apr 2023 10:38:38 +0200 Subject: [PATCH 5/6] Partially address review --- Doc/library/sqlite3.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 7328c08aef4d14..6cab73f8974fb9 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -595,12 +595,12 @@ Module constants These constants are used for the :meth:`Connection.setconfig` and :meth:`~Connection.getconfig` methods. - The availability of these constants vary depending on the version of SQLite + The availability of these constants varies depending on the version of SQLite Python was compiled with. - ..versionadded:: 3.12 + .. versionadded:: 3.12 - ..seealso:: + .. seealso:: https://www.sqlite.org/c3ref/c_dbconfig_defensive.html SQLite docs: Database Connection Configuration Options From c47ac5e39e03a560d9b30ad0b215dc416f66f355 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 26 Apr 2023 21:18:37 +0200 Subject: [PATCH 6/6] Update docstring to reflect docs --- Modules/_sqlite/clinic/connection.c.h | 6 +++--- Modules/_sqlite/connection.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Modules/_sqlite/clinic/connection.c.h b/Modules/_sqlite/clinic/connection.c.h index 3417d1f0519276..cd20d79acffbf8 100644 --- a/Modules/_sqlite/clinic/connection.c.h +++ b/Modules/_sqlite/clinic/connection.c.h @@ -1517,7 +1517,7 @@ PyDoc_STRVAR(setconfig__doc__, "setconfig($self, op, enable=True, /)\n" "--\n" "\n" -"\n" +"Set a boolean connection configuration option.\n" "\n" " op\n" " The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); @@ -1560,7 +1560,7 @@ PyDoc_STRVAR(getconfig__doc__, "getconfig($self, op, /)\n" "--\n" "\n" -"\n" +"Query a boolean connection configuration option.\n" "\n" " op\n" " The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes."); @@ -1611,4 +1611,4 @@ getconfig(pysqlite_Connection *self, PyObject *arg) #ifndef DESERIALIZE_METHODDEF #define DESERIALIZE_METHODDEF #endif /* !defined(DESERIALIZE_METHODDEF) */ -/*[clinic end generated code: output=84560376421204ce input=a9049054013a1b77]*/ +/*[clinic end generated code: output=29c3ecac5add6857 input=a9049054013a1b77]*/ diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index fe2f64d7b67d57..c9a4487841812c 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -2398,11 +2398,12 @@ _sqlite3.Connection.setconfig as setconfig enable: bool = True / +Set a boolean connection configuration option. [clinic start generated code]*/ static PyObject * setconfig_impl(pysqlite_Connection *self, int op, int enable) -/*[clinic end generated code: output=c60b13e618aff873 input=01d77271ea8ca45f]*/ +/*[clinic end generated code: output=c60b13e618aff873 input=a10f1539c2d7da6b]*/ { if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return NULL; @@ -2431,11 +2432,12 @@ _sqlite3.Connection.getconfig as getconfig -> bool The configuration verb; one of the sqlite3.SQLITE_DBCONFIG codes. / +Query a boolean connection configuration option. [clinic start generated code]*/ static int getconfig_impl(pysqlite_Connection *self, int op) -/*[clinic end generated code: output=25ac05044c7b78a3 input=667d2ef05fff2f61]*/ +/*[clinic end generated code: output=25ac05044c7b78a3 input=b0526d7e432e3f2f]*/ { if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) { return -1;