From: Erlend Egeberg Aasland Date: Thu, 7 Jul 2022 22:33:17 +0000 (+0200) Subject: gh-94321: Document sqlite3.PrepareProtocol (#94620) X-Git-Tag: v3.12.0a1~1000 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fb6dccae348b954d9f625031b54711a9a33da525;p=thirdparty%2FPython%2Fcpython.git gh-94321: Document sqlite3.PrepareProtocol (#94620) --- diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index ad49a217d3b4..2f4e2aeef939 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1139,6 +1139,16 @@ Blob Objects end). +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 + ` to :ref:`native SQLite types `. + + .. _sqlite3-exceptions: Exceptions @@ -1297,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 """""""""""""""""""""""""""""""" diff --git a/Misc/NEWS.d/next/Documentation/2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst b/Misc/NEWS.d/next/Documentation/2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst new file mode 100644 index 000000000000..c1a8dcd85353 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst @@ -0,0 +1,2 @@ +Document the :pep:`246` style protocol type +:class:`sqlite3.PrepareProtocol`. diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c index cefb46e390ad..44533225665d 100644 --- a/Modules/_sqlite/prepare_protocol.c +++ b/Modules/_sqlite/prepare_protocol.c @@ -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}, };