File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1469,8 +1469,6 @@ def test_blob_closed(self):
14691469 with self .assertRaisesRegex (sqlite .ProgrammingError , msg ):
14701470 blob [0 ] = b""
14711471
1472- # TODO: RUSTPYTHON
1473- @unittest .expectedFailure
14741472 def test_blob_closed_db_read (self ):
14751473 with memory_database () as cx :
14761474 cx .execute ("create table test(b blob)" )
Original file line number Diff line number Diff line change @@ -1007,6 +1007,10 @@ mod _sqlite {
10071007 Ok ( ( ) )
10081008 }
10091009
1010+ fn is_closed ( & self ) -> bool {
1011+ self . db . lock ( ) . is_none ( )
1012+ }
1013+
10101014 #[ pymethod]
10111015 fn commit ( & self , vm : & VirtualMachine ) -> PyResult < ( ) > {
10121016 self . db_lock ( vm) ?. implicit_commit ( vm)
@@ -2169,6 +2173,13 @@ mod _sqlite {
21692173 length : OptionalArg < c_int > ,
21702174 vm : & VirtualMachine ,
21712175 ) -> PyResult < PyRef < PyBytes > > {
2176+ if self . connection . is_closed ( ) {
2177+ return Err ( new_programming_error (
2178+ vm,
2179+ "Cannot operate on a closed database" . to_owned ( ) ,
2180+ ) ) ;
2181+ }
2182+
21722183 let mut length = length. unwrap_or ( -1 ) ;
21732184 let mut inner = self . inner ( vm) ?;
21742185 let blob_len = inner. blob . bytes ( ) ;
You can’t perform that action at this time.
0 commit comments