summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-09-21 22:05:17 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2020-10-04 16:36:45 (GMT)
commitbd55c46895d2fcfadda46701d3c34d78441a7806 (patch)
treeb92eb02821de3adcffac12f990819637f9dce4a2 /Lib
parentd6360891b343dd4f7cafbaa3fc2e2164e348c38e (diff)
downloadcpython-bd55c46895d2fcfadda46701d3c34d78441a7806.zip
cpython-bd55c46895d2fcfadda46701d3c34d78441a7806.tar.gz
cpython-bd55c46895d2fcfadda46701d3c34d78441a7806.tar.bz2
bpo-41815: SQLite: segfault if backup called on closed database (GH-22322)
GH- [bpo-41815](): SQLite: fix segfault if backup called on closed database Attempting to backup a closed database will trigger segfault: ```python import sqlite3 target = sqlite3.connect(':memory:') source = sqlite3.connect(':memory:') source.close() source.backup(target) ``` (cherry picked from commit bfee9fad84531a471fd7864e88947320669f68e2) Co-authored-by: Peter McCormick <peter@pdmccormick.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sqlite3/test/backup.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/backup.py b/Lib/sqlite3/test/backup.py
index 903bacf..ad1da97 100644
--- a/Lib/sqlite3/test/backup.py
+++ b/Lib/sqlite3/test/backup.py
@@ -36,6 +36,13 @@ class BackupTests(unittest.TestCase):
with self.assertRaises(sqlite.ProgrammingError):
self.cx.backup(bck)
+ def test_bad_source_closed_connection(self):
+ bck = sqlite.connect(':memory:')
+ source = sqlite.connect(":memory:")
+ source.close()
+ with self.assertRaises(sqlite.ProgrammingError):
+ source.backup(bck)
+
def test_bad_target_in_transaction(self):
bck = sqlite.connect(':memory:')
bck.execute('CREATE TABLE bar (key INTEGER)')