File tree Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Expand file tree Collapse file tree 4 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,14 @@ Deprecated
486486  scheduled for removal in Python 3.12.
487487  (Contributed by Erlend E. Aasland in :issue: `42264 `.)
488488
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+ 
489497
490498Removed
491499======= 
Original file line number Diff line number Diff line change @@ -84,6 +84,20 @@ def convert_timestamp(val):
8484
8585register_adapters_and_converters ()
8686
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+ 
87101# Clean up namespace 
88102
89103del (register_adapters_and_converters )
Original file line number Diff line number Diff line change @@ -83,6 +83,13 @@ def CheckNotSupportedError(self):
8383                                   sqlite .DatabaseError ),
8484                        "NotSupportedError is not a subclass of DatabaseError" )
8585
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+ 
8693class  ConnectionTests (unittest .TestCase ):
8794
8895    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