Skip to content

Commit

Permalink
[3.10] pythongh-94321: Document sqlite3.PrepareProtocol (pythonGH-94620
Browse files Browse the repository at this point in the history
…) (python#94671)

(cherry picked from commit fb6dcca)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
  • Loading branch information
erlend-aasland authored Jul 7, 2022
1 parent 860aefa commit 797745e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,16 @@ Now we plug :class:`Row` in::
35.14


PrepareProtocol Objects
-----------------------

.. class:: PrepareProtocol

The PrepareProtocol type's single purpose is to act as a :pep:`246` style
adaption protocol for objects that can :ref:`adapt themselves
<sqlite3-conform>` to :ref:`native SQLite types <sqlite3-types>`.


.. _sqlite3-exceptions:

Exceptions
Expand Down Expand Up @@ -1055,6 +1065,8 @@ As an application developer, it may make more sense to take direct control by
registering custom adapter functions.


.. _sqlite3-conform:

Letting your object adapt itself
""""""""""""""""""""""""""""""""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document the :pep:`246` style protocol type
:class:`sqlite3.PrepareProtocol`.
3 changes: 3 additions & 0 deletions Modules/_sqlite/prepare_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
Py_DECREF(tp);
}

PyDoc_STRVAR(doc, "PEP 246 style object adaption protocol type.");

static PyType_Slot type_slots[] = {
{Py_tp_dealloc, pysqlite_prepare_protocol_dealloc},
{Py_tp_init, pysqlite_prepare_protocol_init},
{Py_tp_traverse, pysqlite_prepare_protocol_traverse},
{Py_tp_doc, (void *)doc},
{0, NULL},
};

Expand Down

0 comments on commit 797745e

Please sign in to comment.