Skip to content

Commit fb6dcca

Browse files
gh-94321: Document sqlite3.PrepareProtocol (#94620)
1 parent 7169766 commit fb6dcca

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Doc/library/sqlite3.rst

+12
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,16 @@ Blob Objects
11391139
end).
11401140

11411141

1142+
PrepareProtocol Objects
1143+
-----------------------
1144+
1145+
.. class:: PrepareProtocol
1146+
1147+
The PrepareProtocol type's single purpose is to act as a :pep:`246` style
1148+
adaption protocol for objects that can :ref:`adapt themselves
1149+
<sqlite3-conform>` to :ref:`native SQLite types <sqlite3-types>`.
1150+
1151+
11421152
.. _sqlite3-exceptions:
11431153

11441154
Exceptions
@@ -1297,6 +1307,8 @@ As an application developer, it may make more sense to take direct control by
12971307
registering custom adapter functions.
12981308

12991309

1310+
.. _sqlite3-conform:
1311+
13001312
Letting your object adapt itself
13011313
""""""""""""""""""""""""""""""""
13021314

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document the :pep:`246` style protocol type
2+
:class:`sqlite3.PrepareProtocol`.

Modules/_sqlite/prepare_protocol.c

+3
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
4646
Py_DECREF(tp);
4747
}
4848

49+
PyDoc_STRVAR(doc, "PEP 246 style object adaption protocol type.");
50+
4951
static PyType_Slot type_slots[] = {
5052
{Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
5153
{Py_tp_init, pysqlite_prepare_protocol_init},
5254
{Py_tp_traverse, pysqlite_prepare_protocol_traverse},
55+
{Py_tp_doc, (void *)doc},
5356
{0, NULL},
5457
};
5558

0 commit comments

Comments
 (0)