File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -462,6 +462,14 @@ Deprecated
462
462
scheduled for removal in Python 3.12.
463
463
(Contributed by Erlend E. Aasland in :issue: `42264 `.)
464
464
465
+ * ``sqlite3.enable_shared_cache `` is now deprecated, scheduled for removal in
466
+ Python 3.12. The method is undocumented, and it's use is strongly
467
+ discouraged by the SQLite3 documentation. See `the SQLite3 docs
468
+ <https://sqlite.org/c3ref/enable_shared_cache.html/> ` for more details. If
469
+ shared cache must be used, open the database in URI mode using the
470
+ ``cache=shared `` query parameter.
471
+ (Contributed by Erlend E. Aasland in :issue: `24464 `.)
472
+
465
473
466
474
Removed
467
475
=======
Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ def convert_timestamp(val):
84
84
85
85
register_adapters_and_converters ()
86
86
87
+ # bpo-24464: enable_shared_cache was deprecated in Python 3.10. It's
88
+ # scheduled for removal in Python 3.12.
89
+ _old_enable_shared_cache = enable_shared_cache
90
+ def enable_shared_cache (enable ):
91
+ import warnings
92
+ msg = ("""
93
+ enable_shared_cache is deprecated and will be removed in Python 3.12.
94
+ Shared cache is strongly discouraged by the SQLite 3 documentation.
95
+ If shared cache must be used, open the database in URI mode using
96
+ the cache=shared query parameter.
97
+ """ )
98
+ warnings .warn (msg , DeprecationWarning , stacklevel = 2 )
99
+ return _old_enable_shared_cache
100
+
87
101
# Clean up namespace
88
102
89
103
del (register_adapters_and_converters )
Original file line number Diff line number Diff line change @@ -83,6 +83,13 @@ def CheckNotSupportedError(self):
83
83
sqlite .DatabaseError ),
84
84
"NotSupportedError is not a subclass of DatabaseError" )
85
85
86
+ def CheckSharedCacheDeprecated (self ):
87
+ for enable in (True , False ):
88
+ with self .assertWarns (DeprecationWarning ) as cm :
89
+ sqlite .enable_shared_cache (enable )
90
+ self .assertIn ("dbapi.py" , cm .filename )
91
+
92
+
86
93
class ConnectionTests (unittest .TestCase ):
87
94
88
95
def setUp (self ):
You can’t perform that action at this time.
0 commit comments