From 7ad6f24a53e1892fb54f14e4dd91e98c7c21d092 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 6 Jul 2022 23:31:27 +0200 Subject: [PATCH 1/5] gh-94321: Document sqlite3.PrepareProtocol --- Doc/library/sqlite3.rst | 11 +++++++++++ Modules/_sqlite/prepare_protocol.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index b5cd6894e8060a..1e45aabb553359 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -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 +` to :ref:`native SQLite 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 """""""""""""""""""""""""""""""" diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c index cefb46e390ad6b..be24e7a758e2da 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, "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}, }; From d5b6ee81f4d986b75b2889b46c66fcefc320ed82 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 6 Jul 2022 23:38:08 +0200 Subject: [PATCH 2/5] Adjust class docstr --- Modules/_sqlite/prepare_protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_sqlite/prepare_protocol.c b/Modules/_sqlite/prepare_protocol.c index be24e7a758e2da..8c14d1ca304a27 100644 --- a/Modules/_sqlite/prepare_protocol.c +++ b/Modules/_sqlite/prepare_protocol.c @@ -46,7 +46,7 @@ pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self) Py_DECREF(tp); } -PyDoc_STRVAR(doc, "sqlite3 object adaption protocol type"); +PyDoc_STRVAR(doc, "PEP-246 style object adaption protocol type."); static PyType_Slot type_slots[] = { {Py_tp_dealloc, pysqlite_prepare_protocol_dealloc}, From a594f27c54c54f87460fc798809fea63b463103f Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 6 Jul 2022 23:59:15 +0200 Subject: [PATCH 3/5] Fix syntax --- Doc/library/sqlite3.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 1e45aabb553359..c26eaed6e1ae04 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1307,7 +1307,7 @@ As an application developer, it may make more sense to take direct control by registering custom adapter functions. -.. _sqlite3-conform +.. _sqlite3-conform: Letting your object adapt itself """""""""""""""""""""""""""""""" From e20fd19a411d35a1923958fc44a7df3162951830 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 7 Jul 2022 08:42:11 +0200 Subject: [PATCH 4/5] Address CAM's review --- Doc/library/sqlite3.rst | 8 +++----- .../2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst | 2 ++ Modules/_sqlite/prepare_protocol.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2022-07-07-08-42-05.gh-issue-94321.pmCIPb.rst diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index c26eaed6e1ae04..cc392b367c0d37 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1140,13 +1140,11 @@ 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 -` to :ref:`native SQLite types `. + 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: 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 00000000000000..c1a8dcd8535383 --- /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 8c14d1ca304a27..44533225665dab 100644 --- a/Modules/_sqlite/prepare_protocol.c +++ b/Modules/_sqlite/prepare_protocol.c @@ -46,7 +46,7 @@ pysqlite_prepare_protocol_dealloc(pysqlite_PrepareProtocol *self) Py_DECREF(tp); } -PyDoc_STRVAR(doc, "PEP-246 style object adaption protocol type."); +PyDoc_STRVAR(doc, "PEP 246 style object adaption protocol type."); static PyType_Slot type_slots[] = { {Py_tp_dealloc, pysqlite_prepare_protocol_dealloc}, From cc04744caa9ea03b423fd154a8fb1a56266c980b Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Fri, 8 Jul 2022 00:08:05 +0200 Subject: [PATCH 5/5] Add missing heading --- Doc/library/sqlite3.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index cc392b367c0d37..eac4ee59a697d3 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -1140,6 +1140,9 @@ Blob Objects end). +PrepareProtocol Objects +----------------------- + .. class:: PrepareProtocol The PrepareProtocol type's single purpose is to act as a :pep:`246` style