summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-09-21 22:00:34 (GMT)
committerGitHub <noreply@github.com>2020-09-21 22:00:34 (GMT)
commitca2d99d091a5b7768e92ee5ce7104aa6d8a3ed86 (patch)
tree8e46e217e539f10a3276424ce51e57cad18476cb /Lib/sqlite3
parent488e3eb70d24d5ce55ae0d7aed13a3721d3eb8a1 (diff)
downloadcpython-ca2d99d091a5b7768e92ee5ce7104aa6d8a3ed86.zip
cpython-ca2d99d091a5b7768e92ee5ce7104aa6d8a3ed86.tar.gz
cpython-ca2d99d091a5b7768e92ee5ce7104aa6d8a3ed86.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/sqlite3')
-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)')