File tree 4 files changed +32
-0
lines changed
4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,14 @@ Deprecated
486
486
scheduled for removal in Python 3.12.
487
487
(Contributed by Erlend E. Aasland in :issue: `42264 `.)
488
488
489
+ * The undocumented built-in function ``sqlite3.enable_shared_cache `` is now
490
+ deprecated, scheduled for removal in Python 3.12. Its use is strongly
491
+ discouraged by the SQLite3 documentation. See `the SQLite3 docs
492
+ <https://sqlite.org/c3ref/enable_shared_cache.html/> `_ for more details.
493
+ If shared cache must be used, open the database in URI mode using the
494
+ ``cache=shared `` query parameter.
495
+ (Contributed by Erlend E. Aasland in :issue: `24464 `.)
496
+
489
497
490
498
Removed
491
499
=======
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
+ def enable_shared_cache (enable ):
90
+ from _sqlite3 import enable_shared_cache as _old_enable_shared_cache
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 ):
Original file line number Diff line number Diff line change
1
+ The undocumented built-in function ``sqlite3.enable_shared_cache `` is now
2
+ deprecated, scheduled for removal in Python 3.12. Its use is strongly
3
+ discouraged by the SQLite3 documentation. Patch by Erlend E. Aasland.
You can’t perform that action at this time.
0 commit comments