Skip to content

Commit c72001e

Browse files
gh-94321: Document sqlite3.PrepareProtocol (GH-94620)
(cherry picked from commit fb6dcca) Co-authored-by: Erlend Egeberg Aasland <[email protected]>
1 parent 77a0153 commit c72001e

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Doc/library/sqlite3.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,16 @@ Blob Objects
11271127
end).
11281128

11291129

1130+
PrepareProtocol Objects
1131+
-----------------------
1132+
1133+
.. class:: PrepareProtocol
1134+
1135+
The PrepareProtocol type's single purpose is to act as a :pep:`246` style
1136+
adaption protocol for objects that can :ref:`adapt themselves
1137+
<sqlite3-conform>` to :ref:`native SQLite types <sqlite3-types>`.
1138+
1139+
11301140
.. _sqlite3-exceptions:
11311141

11321142
Exceptions
@@ -1287,6 +1297,8 @@ As an application developer, it may make more sense to take direct control by
12871297
registering custom adapter functions.
12881298

12891299

1300+
.. _sqlite3-conform:
1301+
12901302
Letting your object adapt itself
12911303
""""""""""""""""""""""""""""""""
12921304

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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)