Skip to content

Commit 7ad6f24

Browse files
pythongh-94321: Document sqlite3.PrepareProtocol
1 parent 760b8cf commit 7ad6f24

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Doc/library/sqlite3.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,15 @@ Blob Objects
11401140
end).
11411141

11421142

1143+
.. _sqlite3-prepareprotocol-objects:
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+
11431152
.. _sqlite3-exceptions:
11441153

11451154
Exceptions
@@ -1298,6 +1307,8 @@ As an application developer, it may make more sense to take direct control by
12981307
registering custom adapter functions.
12991308

13001309

1310+
.. _sqlite3-conform
1311+
13011312
Letting your object adapt itself
13021313
""""""""""""""""""""""""""""""""
13031314

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, "sqlite3 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)