-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Implement inspect.signature() for sqlite3 connection object #118406
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
Comments
This is interesting. At first, I thought a simple patch a la this could fix it: diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 74984ca536..f49bcd0b49 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -2561,6 +2561,13 @@ set_autocommit(pysqlite_Connection *self, PyObject *val, void *Py_UNUSED(ctx))
return 0;
}
+#include "clinic/_sqlite3.connect.c.h"
+static PyObject *
+get_sig(pysqlite_Connection *self, void *Py_UNUSED(ctx))
+{
+ return PyUnicode_FromString(pysqlite_connect__doc__);
+}
+
static const char connection_doc[] =
PyDoc_STR("SQLite database connection object.");
@@ -2570,6 +2577,7 @@ static PyGetSetDef connection_getset[] = {
{"total_changes", (getter)pysqlite_connection_get_total_changes, (setter)0},
{"in_transaction", (getter)pysqlite_connection_get_in_transaction, (setter)0},
{"autocommit", (getter)get_autocommit, (setter)set_autocommit},
+ {"__text_signature__", (getter)get_sig, (setter)0},
{NULL}
};
However, |
Simply return I have not solved this simple issue only because it needs tests, and searching in which of many of test_sqlite3 files is more suitable takes time. |
See also #118427 for example. |
Ah, I used the incorrect signature. I'll propose a PR soon. |
Feature or enhancement
sqlite3.connection()
returns a custom callable object. Butinspect.signature()
returns a generic<Signature (*args, **kwargs)>
for it:This issue is similar to #118285 and #118402.
Linked PRs
The text was updated successfully, but these errors were encountered: