File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -408,6 +408,11 @@ fn io_base_cm_enter(instance: PyObjectRef) -> PyObjectRef {
408
408
instance
409
409
}
410
410
411
+ fn io_base_cm_del ( instance : PyObjectRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
412
+ vm. call_method ( & instance, "close" , vec ! [ ] ) ?;
413
+ Ok ( ( ) )
414
+ }
415
+
411
416
fn io_base_cm_exit ( instance : PyObjectRef , _args : PyFuncArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
412
417
vm. call_method ( & instance, "close" , vec ! [ ] ) ?;
413
418
Ok ( ( ) )
@@ -1269,6 +1274,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef {
1269
1274
// IOBase the abstract base class of the IO Module
1270
1275
let io_base = py_class ! ( ctx, "_IOBase" , & ctx. types. object_type, {
1271
1276
"__enter__" => ctx. new_method( io_base_cm_enter) ,
1277
+ "__del__" => ctx. new_method( io_base_cm_del) ,
1272
1278
"__exit__" => ctx. new_method( io_base_cm_exit) ,
1273
1279
"seekable" => ctx. new_method( io_base_seekable) ,
1274
1280
"readable" => ctx. new_method( io_base_readable) ,
You can’t perform that action at this time.
0 commit comments