From 73b39d3791d40a789922900ff4a8e66c876919ea Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Tue, 12 Sep 2023 04:12:20 +0300 Subject: [PATCH 01/21] Enhanced sqlite3 connection context management documentation with contextlib.closing --- .gitignore | 2 +- Doc/library/sqlite3.rst | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d9c4a7972f076d..c31301730b1275 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,7 @@ core ##### # Then, rules meant for a specific location relative to the repo root. # These must contain a non-trailing slash (and may also have a trailing slash.) - +venv Doc/build/ Doc/venv/ Doc/.venv/ diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 51146e00999659..257b99a77c652f 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2319,6 +2319,8 @@ If there is no open transaction upon leaving the body of the ``with`` statement, or if :attr:`~Connection.autocommit` is ``True``, the context manager does nothing. + + .. note:: The context manager neither implicitly opens a new transaction @@ -2345,6 +2347,28 @@ the context manager does nothing. # so the connection object should be closed manually con.close() +``context.closing`` can also be used to perform singular transactions. +In this case, the ``sqlite3`` connection is closed without an additional +``sqlite.connect().close()`` after a context manager closes. + +For default ``sqlite`` context management cases which don't use +``contextlib.closing``, this is intended to perform multiple transactions +without fully closing the connection. + +A ``contextlib.closing`` example + +.. testcode:: + + import sqlite3 + from contextlib import closing + + with closing(sqlite3.connect("workfile.sqlite")) as cx: + with cx: + cx.execute("CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)") + cx.execute("INSERT INTO lang(name) VALUES(?)", ("Python",)) + + + # no need to close the connection as contextlib.closing closed it for us .. testoutput:: :hide: @@ -2353,6 +2377,7 @@ the context manager does nothing. .. _sqlite3-uri-tricks: + How to work with SQLite URIs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 0ece8fb5463c6ade8d1eaf9eebdc47b9f582e2d1 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 08:14:28 +0000 Subject: [PATCH 02/21] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst diff --git a/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst b/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst new file mode 100644 index 00000000000000..b3df010efec7f9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst @@ -0,0 +1,2 @@ +This change enhances the existing sqlite3 docs on context management by adding a mention of the contextlib.closing. +This will help guide developers when performing singular transactions. From 89aef426a7d0899d58ec955b87a06e65336d90bd Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Wed, 13 Sep 2023 11:46:36 +0300 Subject: [PATCH 03/21] Fixed gitignore spelling error from nitignore to gitignore --- Doc/tools/{.nitignore => .gitignore} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Doc/tools/{.nitignore => .gitignore} (100%) diff --git a/Doc/tools/.nitignore b/Doc/tools/.gitignore similarity index 100% rename from Doc/tools/.nitignore rename to Doc/tools/.gitignore From b8eeab621e348795f928fa6faf2d7063a9f65632 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Wed, 13 Sep 2023 12:14:52 +0300 Subject: [PATCH 04/21] Renamed .gitignore to .nitignore --- Doc/tools/{.gitignore => .nitignore} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Doc/tools/{.gitignore => .nitignore} (100%) diff --git a/Doc/tools/.gitignore b/Doc/tools/.nitignore similarity index 100% rename from Doc/tools/.gitignore rename to Doc/tools/.nitignore From 164150c2305981e971d1d02e52bf6db7cd2a94b0 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Wed, 13 Sep 2023 14:48:42 +0300 Subject: [PATCH 05/21] Added generated doctests --- Doc/backup.db | Bin 0 -> 4096 bytes Doc/dump.sql | 2 ++ Doc/example.db | 0 Doc/tutorial.db | Bin 0 -> 8192 bytes Doc/workfile.sqlite | Bin 0 -> 12288 bytes 5 files changed, 2 insertions(+) create mode 100644 Doc/backup.db create mode 100644 Doc/dump.sql create mode 100644 Doc/example.db create mode 100644 Doc/tutorial.db create mode 100644 Doc/workfile.sqlite diff --git a/Doc/backup.db b/Doc/backup.db new file mode 100644 index 0000000000000000000000000000000000000000..766c734878829a41b8a0b9e95131a421007c0b82 GIT binary patch literal 4096 zcmWFz^vNtqRY=P(%1ta$FlG>7U}R))P*7lCU|@t|AO!{>KB<6_K`-k9FG!aFsai+X qkA}c#2#kinXb6mkz-S1JhQMeDjE2By2#kinXb6mkz-S0iD+B=GrUyy@ literal 0 HcmV?d00001 diff --git a/Doc/dump.sql b/Doc/dump.sql new file mode 100644 index 00000000000000..5a9078ceb3e497 --- /dev/null +++ b/Doc/dump.sql @@ -0,0 +1,2 @@ +BEGIN TRANSACTION; +COMMIT; diff --git a/Doc/example.db b/Doc/example.db new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/Doc/tutorial.db b/Doc/tutorial.db new file mode 100644 index 0000000000000000000000000000000000000000..5f7225de83a1a7d954d892d9a13d6c4b4563969f GIT binary patch literal 8192 zcmeI%PfNov6aes~X67XIwwu12f0#oM!GnixvnaTUbGwKaqf1>RZKMku{UoAa!-EGw z!B3#y$Yiqz6+C#9_h{Njc(0HCZY8~LTUiN-$x~rri!2gKNd!O$VQvL(mEm*0R|YMU zU!IKAuiqA20S#Y?yD(4y1yBG5Pyhu`00mG01yBG5Pyhw~B(O{8tJNw!wcGU!tX1$MzgM``Y0O#uD6NyLEjBM(bi?%mA8ZqWN>QeCOkSCtxDrjcfo% zX5vrhp=VNQhki!Oq&HexsSDUsNg{KZS^iKC+@S36+d$!7^Es@5{ah%`A0tSn@d2NS BY-Iod literal 0 HcmV?d00001 diff --git a/Doc/workfile.sqlite b/Doc/workfile.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..b772169c6771aafa372d3b0a002681de0bb399b9 GIT binary patch literal 12288 zcmeI#K}*9h6bJB^R@4e3Udq_*-Bb`kJbJN?pv5`1tP^%Bl~t{DEouh3o1f5qnTbae zW#`??|B;vEwIq<=?Tv=L!sPr=zs@qlXS7d3&;>IQc{Y8U>kxLcwJz-H>P_L%$@8)$ zf5?*yk_-8@=>Yyi00Izz00bZa0SG_<0uX=z1ezr<5(Wy Date: Wed, 13 Sep 2023 15:45:16 +0300 Subject: [PATCH 06/21] Deleted sqlite3 generated files --- Doc/backup.db | Bin 4096 -> 0 bytes Doc/dump.sql | 2 -- Doc/example.db | 0 Doc/tutorial.db | Bin 8192 -> 0 bytes Doc/workfile.sqlite | Bin 12288 -> 0 bytes 5 files changed, 2 deletions(-) delete mode 100644 Doc/backup.db delete mode 100644 Doc/dump.sql delete mode 100644 Doc/example.db delete mode 100644 Doc/tutorial.db delete mode 100644 Doc/workfile.sqlite diff --git a/Doc/backup.db b/Doc/backup.db deleted file mode 100644 index 766c734878829a41b8a0b9e95131a421007c0b82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmWFz^vNtqRY=P(%1ta$FlG>7U}R))P*7lCU|@t|AO!{>KB<6_K`-k9FG!aFsai+X qkA}c#2#kinXb6mkz-S1JhQMeDjE2By2#kinXb6mkz-S0iD+B=GrUyy@ diff --git a/Doc/dump.sql b/Doc/dump.sql deleted file mode 100644 index 5a9078ceb3e497..00000000000000 --- a/Doc/dump.sql +++ /dev/null @@ -1,2 +0,0 @@ -BEGIN TRANSACTION; -COMMIT; diff --git a/Doc/example.db b/Doc/example.db deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/Doc/tutorial.db b/Doc/tutorial.db deleted file mode 100644 index 5f7225de83a1a7d954d892d9a13d6c4b4563969f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeI%PfNov6aes~X67XIwwu12f0#oM!GnixvnaTUbGwKaqf1>RZKMku{UoAa!-EGw z!B3#y$Yiqz6+C#9_h{Njc(0HCZY8~LTUiN-$x~rri!2gKNd!O$VQvL(mEm*0R|YMU zU!IKAuiqA20S#Y?yD(4y1yBG5Pyhu`00mG01yBG5Pyhw~B(O{8tJNw!wcGU!tX1$MzgM``Y0O#uD6NyLEjBM(bi?%mA8ZqWN>QeCOkSCtxDrjcfo% zX5vrhp=VNQhki!Oq&HexsSDUsNg{KZS^iKC+@S36+d$!7^Es@5{ah%`A0tSn@d2NS BY-Iod diff --git a/Doc/workfile.sqlite b/Doc/workfile.sqlite deleted file mode 100644 index b772169c6771aafa372d3b0a002681de0bb399b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI#K}*9h6bJB^R@4e3Udq_*-Bb`kJbJN?pv5`1tP^%Bl~t{DEouh3o1f5qnTbae zW#`??|B;vEwIq<=?Tv=L!sPr=zs@qlXS7d3&;>IQc{Y8U>kxLcwJz-H>P_L%$@8)$ zf5?*yk_-8@=>Yyi00Izz00bZa0SG_<0uX=z1ezr<5(Wy Date: Mon, 18 Sep 2023 19:38:22 +0300 Subject: [PATCH 07/21] Removed white-space changes --- .gitignore | 1 - Doc/library/sqlite3.rst | 2 -- 2 files changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 191a1649386c2a..50bfc0f2443e55 100644 --- a/.gitignore +++ b/.gitignore @@ -54,7 +54,6 @@ core ##### # Then, rules meant for a specific location relative to the repo root. # These must contain a non-trailing slash (and may also have a trailing slash.) -venv Doc/build/ Doc/venv/ Doc/.venv/ diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index a37d62e4877ca4..b27ac444723df0 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2439,8 +2439,6 @@ If there is no open transaction upon leaving the body of the ``with`` statement, or if :attr:`~Connection.autocommit` is ``True``, the context manager does nothing. - - .. note:: The context manager neither implicitly opens a new transaction From e4d6417bdb27f3058f04d27412dd6072992eb78c Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 18 Sep 2023 20:00:08 +0300 Subject: [PATCH 08/21] Removed News entry from the doc --- .../next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst diff --git a/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst b/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst deleted file mode 100644 index b3df010efec7f9..00000000000000 --- a/Misc/NEWS.d/next/Library/2023-09-13-08-14-28.gh-issue-109234._vZIUm.rst +++ /dev/null @@ -1,2 +0,0 @@ -This change enhances the existing sqlite3 docs on context management by adding a mention of the contextlib.closing. -This will help guide developers when performing singular transactions. From f51cad8cf9bb94900435037776937867dfc28bf2 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 18 Sep 2023 20:16:06 +0300 Subject: [PATCH 09/21] Expanded a note that context manager can be used for connection management using contextlib.closing --- Doc/library/sqlite3.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index b27ac444723df0..57bf3187835f5d 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2442,7 +2442,8 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction - nor closes the connection. + nor closes the connection. Using ``contextlib.closing``, the context manager + can be used for connection management. .. testcode:: From cab833b0cd1a82601f91523199130179558ae49c Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 18 Sep 2023 20:20:38 +0300 Subject: [PATCH 10/21] Removed repeated contextlib.closing code snippet --- Doc/library/sqlite3.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 57bf3187835f5d..bf7daab7a7efb8 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2474,20 +2474,6 @@ For default ``sqlite`` context management cases which don't use ``contextlib.closing``, this is intended to perform multiple transactions without fully closing the connection. -A ``contextlib.closing`` example - -.. testcode:: - - import sqlite3 - from contextlib import closing - - with closing(sqlite3.connect("workfile.sqlite")) as cx: - with cx: - cx.execute("CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)") - cx.execute("INSERT INTO lang(name) VALUES(?)", ("Python",)) - - - # no need to close the connection as contextlib.closing closed it for us .. testoutput:: :hide: From 4a6d7e7b428ff5d0618aae177a237566468d3feb Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 18 Sep 2023 22:16:43 +0300 Subject: [PATCH 11/21] Expanded the note around usage of context manageer for sqlite3 connection management --- Doc/library/sqlite3.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index bf7daab7a7efb8..a40fe60f70e777 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2443,8 +2443,12 @@ the context manager does nothing. The context manager neither implicitly opens a new transaction nor closes the connection. Using ``contextlib.closing``, the context manager - can be used for connection management. - + can be used for connection management. In this case, the ``sqlite3`` connection + is closed without an additional ``sqlite.connect.close()`` after a context manager + closes. For default ``sqlite`` context management cases which don't use + ``contextlib.closing``, this is intended to perform multiple transactions without + fully closing the connection. + .. testcode:: con = sqlite3.connect(":memory:") @@ -2466,13 +2470,7 @@ the context manager does nothing. # so the connection object should be closed manually con.close() -``context.closing`` can also be used to perform singular transactions. -In this case, the ``sqlite3`` connection is closed without an additional -``sqlite.connect().close()`` after a context manager closes. -For default ``sqlite`` context management cases which don't use -``contextlib.closing``, this is intended to perform multiple transactions -without fully closing the connection. .. testoutput:: :hide: From 19327a2471fb98ab2106e727ab8df036d9d71885 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 18 Sep 2023 22:19:14 +0300 Subject: [PATCH 12/21] Deleted extra white-spaces --- Doc/library/sqlite3.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index a40fe60f70e777..82b01bf59852eb 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2448,7 +2448,7 @@ the context manager does nothing. closes. For default ``sqlite`` context management cases which don't use ``contextlib.closing``, this is intended to perform multiple transactions without fully closing the connection. - + .. testcode:: con = sqlite3.connect(":memory:") @@ -2469,9 +2469,7 @@ the context manager does nothing. # Connection object used as context manager only commits or rollbacks transactions, # so the connection object should be closed manually con.close() - - - + .. testoutput:: :hide: From df79d4b441c8436c932a7eb349aa6ec5b8308bc5 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Tue, 19 Sep 2023 00:03:04 +0300 Subject: [PATCH 13/21] Deleted extra white-space --- Doc/library/sqlite3.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 82b01bf59852eb..7816be76b00d53 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2440,7 +2440,6 @@ or if :attr:`~Connection.autocommit` is ``True``, the context manager does nothing. .. note:: - The context manager neither implicitly opens a new transaction nor closes the connection. Using ``contextlib.closing``, the context manager can be used for connection management. In this case, the ``sqlite3`` connection From a5509cff40df5b8e97cc02d0fa43e4824a5fe396 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Tue, 19 Sep 2023 01:14:18 +0300 Subject: [PATCH 14/21] re-arranged context manager wording --- Doc/library/sqlite3.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 7816be76b00d53..3f336bcc98ee62 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2444,9 +2444,8 @@ the context manager does nothing. nor closes the connection. Using ``contextlib.closing``, the context manager can be used for connection management. In this case, the ``sqlite3`` connection is closed without an additional ``sqlite.connect.close()`` after a context manager - closes. For default ``sqlite`` context management cases which don't use - ``contextlib.closing``, this is intended to perform multiple transactions without - fully closing the connection. + closes. For default ``sqlite`` context management cases which don't use ``contextlib.closing``, + this is intended to perform multiple transactions withoutfully closing the connection. .. testcode:: From f140098e8fbc8f1beacb213c04d1647dc73a6bba Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Wed, 20 Sep 2023 10:24:25 +0300 Subject: [PATCH 15/21] Re-arranged word layout on how to use context manager --- Doc/library/sqlite3.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 3f336bcc98ee62..0be21102ae4023 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2442,10 +2442,11 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction nor closes the connection. Using ``contextlib.closing``, the context manager - can be used for connection management. In this case, the ``sqlite3`` connection - is closed without an additional ``sqlite.connect.close()`` after a context manager - closes. For default ``sqlite`` context management cases which don't use ``contextlib.closing``, - this is intended to perform multiple transactions withoutfully closing the connection. + can be used for connection management. In this case, the ``sqlite3`` + connection is closed without an additional ``sqlite.connect.close()`` after a + context manager closes. For default ``sqlite`` context management cases which don't use + ``contextlib.closing``, this is intended to perform multiple transactions without3fully + closing the connection. .. testcode:: From 9ede06a8601a02a20438ddaeca6a1659e4e1fb25 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 28 Sep 2023 16:42:35 +0200 Subject: [PATCH 16/21] Fix whitespace errors --- Doc/library/sqlite3.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 0be21102ae4023..1d53dfe48b9276 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2442,10 +2442,10 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction nor closes the connection. Using ``contextlib.closing``, the context manager - can be used for connection management. In this case, the ``sqlite3`` - connection is closed without an additional ``sqlite.connect.close()`` after a - context manager closes. For default ``sqlite`` context management cases which don't use - ``contextlib.closing``, this is intended to perform multiple transactions without3fully + can be used for connection management. In this case, the ``sqlite3`` + connection is closed without an additional ``sqlite.connect.close()`` after a + context manager closes. For default ``sqlite`` context management cases which don't use + ``contextlib.closing``, this is intended to perform multiple transactions without3fully closing the connection. .. testcode:: @@ -2468,7 +2468,7 @@ the context manager does nothing. # Connection object used as context manager only commits or rollbacks transactions, # so the connection object should be closed manually con.close() - + .. testoutput:: :hide: From 57d92ad57df5616716042b6b58c4ddd62542bd9e Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Thu, 28 Sep 2023 16:43:23 +0200 Subject: [PATCH 17/21] Remove unneeded change in .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 50bfc0f2443e55..dddf28da016192 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ core ##### # Then, rules meant for a specific location relative to the repo root. # These must contain a non-trailing slash (and may also have a trailing slash.) + Doc/build/ Doc/venv/ Doc/.venv/ From 4210fe9342893655ea3f3e26b05acc082de8da20 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Fri, 29 Sep 2023 17:27:03 +0300 Subject: [PATCH 18/21] Added suggested changes --- Doc/library/sqlite3.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 0be21102ae4023..096b4f1b08d9af 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2441,12 +2441,8 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction - nor closes the connection. Using ``contextlib.closing``, the context manager - can be used for connection management. In this case, the ``sqlite3`` - connection is closed without an additional ``sqlite.connect.close()`` after a - context manager closes. For default ``sqlite`` context management cases which don't use - ``contextlib.closing``, this is intended to perform multiple transactions without3fully - closing the connection. + nor closes the connection. If you need a context manager, consider + using :meth:`contextlib.closing`. .. testcode:: From d660c42b47cd9bde2bfcc6ad4cef243eded21bfb Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Mon, 2 Oct 2023 10:46:18 +0300 Subject: [PATCH 19/21] Added suggested change redirecting to the contextlib.closing implementation --- Doc/library/sqlite3.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 27123610fbfba9..5d3e4536b942c8 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2441,17 +2441,8 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction -<<<<<<< HEAD nor closes the connection. If you need a context manager, consider using :meth:`contextlib.closing`. -======= - nor closes the connection. Using ``contextlib.closing``, the context manager - can be used for connection management. In this case, the ``sqlite3`` - connection is closed without an additional ``sqlite.connect.close()`` after a - context manager closes. For default ``sqlite`` context management cases which don't use - ``contextlib.closing``, this is intended to perform multiple transactions without3fully - closing the connection. ->>>>>>> 57d92ad57df5616716042b6b58c4ddd62542bd9e .. testcode:: From 7fc06d14b251365ca2b5a515a34c98dd3117d832 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Tue, 3 Oct 2023 07:41:36 +0300 Subject: [PATCH 20/21] Added closing keyword --- 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 25cf545c7723eb..bb385e8e59ef3a 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2438,7 +2438,7 @@ the context manager does nothing. .. note:: The context manager neither implicitly opens a new transaction - nor closes the connection. If you need a context manager, consider + nor closes the connection. If you need a closing context manager, consider using :meth:`contextlib.closing`. .. testcode:: From 52ccdad779a5011050fbb630b4ea0672d239a522 Mon Sep 17 00:00:00 2001 From: Lincoln-developer Date: Tue, 3 Oct 2023 16:43:09 +0300 Subject: [PATCH 21/21] Removed line 2473 --- Doc/library/sqlite3.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index bb385e8e59ef3a..aa34bcc9388e1c 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -2470,7 +2470,6 @@ the context manager does nothing. .. _sqlite3-uri-tricks: - How to work with SQLite URIs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^