Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94321: Document sqlite3.PrepareProtocol #94620

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-94321: Document sqlite3.PrepareProtocol
  • Loading branch information
erlend-aasland committed Jul 6, 2022
commit 7ad6f24a53e1892fb54f14e4dd91e98c7c21d092
11 changes: 11 additions & 0 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
@@ -1140,6 +1140,15 @@ Blob Objects
end).


.. _sqlite3-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
@@ -1298,6 +1307,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
""""""""""""""""""""""""""""""""

3 changes: 3 additions & 0 deletions Modules/_sqlite/prepare_protocol.c
Original file line number Diff line number Diff line change
@@ -46,10 +46,13 @@ pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self)
Py_DECREF(tp);
}

PyDoc_STRVAR(doc, "sqlite3 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},
};