summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-08-14 14:37:44 (GMT)
committerGitHub <noreply@github.com>2023-08-14 14:37:44 (GMT)
commit6fbaba552a52f93ecbe8be000888afa0b65b967e (patch)
tree361cc3c1b564949379612eb7052a7cd58d06d46b /Modules/_sqlite/connection.c
parent608927b01447b110de5094271fbc4d49c60130b0 (diff)
downloadcpython-6fbaba552a52f93ecbe8be000888afa0b65b967e.zip
cpython-6fbaba552a52f93ecbe8be000888afa0b65b967e.tar.gz
cpython-6fbaba552a52f93ecbe8be000888afa0b65b967e.tar.bz2
gh-107938: Synchonise the signature of of sqlite3.connect and sqlite3.Connection.__init__ (#107939)
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index ddd7ace..3d2fcd3 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -212,7 +212,6 @@ class sqlite3_int64_converter(CConverter):
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=dff8760fb1eba6a1]*/
-// NB: This needs to be in sync with the sqlite3.connect docstring
/*[clinic input]
_sqlite3.Connection.__init__ as pysqlite_connection_init
@@ -346,6 +345,34 @@ error:
return -1;
}
+/*[clinic input]
+# Create a new destination 'connect' for the docstring and methoddef only.
+# This makes it possible to keep the signatures for Connection.__init__ and
+# sqlite3.connect() synchronised.
+output push
+destination connect new file '{dirname}/clinic/_sqlite3.connect.c.h'
+
+# Only output the docstring and the PyMethodDef entry.
+output everything suppress
+output docstring_definition connect
+output methoddef_define connect
+
+# Define the sqlite3.connect function by cloning Connection.__init__.
+_sqlite3.connect as pysqlite_connect = _sqlite3.Connection.__init__
+
+Open a connection to the SQLite database file 'database'.
+
+You can use ":memory:" to open a database connection to a database that
+resides in RAM instead of on disk.
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=92260edff95d1720]*/
+
+/*[clinic input]
+# Restore normal Argument Clinic operation for the rest of this file.
+output pop
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b899ba9273edcce7]*/
+
#define VISIT_CALLBACK_CONTEXT(ctx) \
do { \
if (ctx) { \