[Python-checkins] bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)

berkerpeksag webhook-mailer at python.org
Sat Jan 9 06:26:03 EST 2021


https://github.com/python/cpython/commit/d16f6176abdecbb7ab231dc78beccfaa095beff6
commit: d16f6176abdecbb7ab231dc78beccfaa095beff6
branch: master
author: Erlend Egeberg Aasland <erlend.aasland at innova.no>
committer: berkerpeksag <berker.peksag at gmail.com>
date: 2021-01-09T13:25:55+02:00
summary:

bpo-24464: Fix sqlite3.enable_shared_cache() deprecation wrapper (GH-24170)

files:
M Lib/sqlite3/dbapi2.py
M Lib/sqlite3/test/dbapi.py

diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 6475f98a646f9..cfe6225f46efc 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -96,7 +96,7 @@ def enable_shared_cache(enable):
         "the cache=shared query parameter."
     )
     warnings.warn(msg, DeprecationWarning, stacklevel=2)
-    return _old_enable_shared_cache
+    return _old_enable_shared_cache(enable)
 
 # Clean up namespace
 
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 68a3062239532..39c9bf5b61143 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -23,6 +23,7 @@
 import threading
 import unittest
 import sqlite3 as sqlite
+import sys
 
 from test.support.os_helper import TESTFN, unlink
 
@@ -82,6 +83,9 @@ def test_not_supported_error(self):
                                    sqlite.DatabaseError),
                         "NotSupportedError is not a subclass of DatabaseError")
 
+    # sqlite3_enable_shared_cache() is deprecated on macOS and calling it may raise
+    # OperationalError on some buildbots.
+    @unittest.skipIf(sys.platform == "darwin", "shared cache is deprecated on macOS")
     def test_shared_cache_deprecated(self):
         for enable in (True, False):
             with self.assertWarns(DeprecationWarning) as cm:



More information about the Python-checkins mailing list