[Python-checkins] [3.10] gh-94321: Document sqlite3.PrepareProtocol (GH-94620) (#94671)

erlend-aasland webhook-mailer at python.org
Thu Jul 7 19:44:24 EDT 2022


https://github.com/python/cpython/commit/797745e749d06d7854605b184892dc07572d84bd
commit: 797745e749d06d7854605b184892dc07572d84bd
branch: 3.10
author: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2022-07-08T01:44:09+02:00
summary:

[3.10] gh-94321: Document sqlite3.PrepareProtocol (GH-94620) (#94671)

(cherry picked from commit fb6dccae348b954d9f625031b54711a9a33da525)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>

files:
A Misc/NEWS.d/next/Documentation/2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst
M Doc/library/sqlite3.rst
M Modules/_sqlite/prepare_protocol.c

diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 280a85e822f69..e666b69e4490b 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -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
@@ -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
 """"""""""""""""""""""""""""""""
 
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 0000000000000..c1a8dcd853538
--- /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 800eef8794b45..aa499842df1c6 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},
 };
 



More information about the Python-checkins mailing list