summaryrefslogtreecommitdiffstats
path: root/Doc/includes/sqlite3/shortcut_methods.py
diff options
context:
space:
mode:
authorXtreak <tir.karthi@gmail.com>2019-05-19 21:52:20 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2019-05-19 21:52:20 (GMT)
commit287b84de939db47aa8c6f30734ceb8aba9d1db29 (patch)
tree0c492acbe1135b59f30a0dc8aa5bfd0705387371 /Doc/includes/sqlite3/shortcut_methods.py
parent5c08ce9bf712acbb3f05a3a57baf51fcb534cdf0 (diff)
downloadcpython-287b84de939db47aa8c6f30734ceb8aba9d1db29.zip
cpython-287b84de939db47aa8c6f30734ceb8aba9d1db29.tar.gz
cpython-287b84de939db47aa8c6f30734ceb8aba9d1db29.tar.bz2
bpo-34580: Update sqlite3 examples to call close() explicitly (GH-9079)
The sqlit3.Connection object doesn't call its close() method when it's used as a context manager.
Diffstat (limited to 'Doc/includes/sqlite3/shortcut_methods.py')
-rw-r--r--Doc/includes/sqlite3/shortcut_methods.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/includes/sqlite3/shortcut_methods.py b/Doc/includes/sqlite3/shortcut_methods.py
index 71600d4..98a3941 100644
--- a/Doc/includes/sqlite3/shortcut_methods.py
+++ b/Doc/includes/sqlite3/shortcut_methods.py
@@ -18,3 +18,7 @@ for row in con.execute("select firstname, lastname from person"):
print(row)
print("I just deleted", con.execute("delete from person").rowcount, "rows")
+
+# close is not a shortcut method and it's not called automatically,
+# so the connection object should be closed manually
+con.close()