gh-108278: Deprecate passing the first param of sqlite3.Connection callback APIs by keyword (#108632)

Deprecate passing the callback callable by keyword for the following
sqlite3.Connection APIs:

- set_authorizer(authorizer_callback)
- set_progress_handler(progress_handler, ...)
- set_trace_callback(trace_callback)

The affected parameters will become positional-only in Python 3.15.
This commit is contained in:
Erlend E. Aasland 2023-08-29 22:02:12 +02:00 committed by GitHub
parent 77e8f233ac
commit 0b0c1d046c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 206 additions and 22 deletions

View file

@ -1499,17 +1499,17 @@ exit:
_sqlite3.Connection.set_authorizer as pysqlite_connection_set_authorizer
cls: defining_class
/
authorizer_callback as callable: object
/ [from 3.15]
Sets authorizer callback.
Set authorizer callback.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable)
/*[clinic end generated code: output=75fa60114fc971c3 input=605d32ba92dd3eca]*/
/*[clinic end generated code: output=75fa60114fc971c3 input=a52bd4937c588752]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@ -1541,18 +1541,25 @@ pysqlite_connection_set_authorizer_impl(pysqlite_Connection *self,
_sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_handler
cls: defining_class
/
progress_handler as callable: object
A callable that takes no arguments.
If the callable returns non-zero, the current query is terminated,
and an exception is raised.
/ [from 3.15]
n: int
The number of SQLite virtual machine instructions that are
executed between invocations of 'progress_handler'.
Sets progress handler callback.
Set progress handler callback.
If 'progress_handler' is None or 'n' is 0, the progress handler is disabled.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable, int n)
/*[clinic end generated code: output=0739957fd8034a50 input=f7c1837984bd86db]*/
/*[clinic end generated code: output=0739957fd8034a50 input=b4d6e2ef8b4d32f9]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@ -1578,17 +1585,17 @@ pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
_sqlite3.Connection.set_trace_callback as pysqlite_connection_set_trace_callback
cls: defining_class
/
trace_callback as callable: object
/ [from 3.15]
Sets a trace callback called for each SQL statement (passed as unicode).
Set a trace callback called for each SQL statement (passed as unicode).
[clinic start generated code]*/
static PyObject *
pysqlite_connection_set_trace_callback_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable)
/*[clinic end generated code: output=d91048c03bfcee05 input=351a94210c5f81bb]*/
/*[clinic end generated code: output=d91048c03bfcee05 input=d705d592ec03cf28]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;