File tree Expand file tree Collapse file tree 4 files changed +4
-8
lines changed Expand file tree Collapse file tree 4 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -1810,7 +1810,7 @@ impl ExecutingFrame<'_> {
1810
1810
fn delete_attr ( & mut self , vm : & VirtualMachine , attr : bytecode:: NameIdx ) -> FrameResult {
1811
1811
let attr_name = self . code . names [ attr as usize ] . clone ( ) ;
1812
1812
let parent = self . pop_value ( ) ;
1813
- vm . del_attr ( & parent , attr_name ) ?;
1813
+ parent . del_attr ( attr_name , vm ) ?;
1814
1814
Ok ( None )
1815
1815
}
1816
1816
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ impl PyObjectRef {
74
74
// int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value)
75
75
76
76
pub fn del_attr ( & self , attr_name : impl IntoPyStrRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
77
- vm. del_attr ( self , attr_name)
77
+ let attr_name = attr_name. into_pystr_ref ( vm) ;
78
+ self . call_set_attr ( vm, attr_name, None )
78
79
}
79
80
80
81
// PyObject *PyObject_GenericGetDict(PyObject *o, void *context)
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ mod builtins {
186
186
187
187
#[ pyfunction]
188
188
fn delattr ( obj : PyObjectRef , attr : PyStrRef , vm : & VirtualMachine ) -> PyResult < ( ) > {
189
- vm . del_attr ( & obj , attr )
189
+ obj . del_attr ( attr , vm )
190
190
}
191
191
192
192
#[ pyfunction]
Original file line number Diff line number Diff line change @@ -1413,11 +1413,6 @@ impl VirtualMachine {
1413
1413
}
1414
1414
}
1415
1415
1416
- pub fn del_attr ( & self , obj : & PyObjectRef , attr_name : impl IntoPyStrRef ) -> PyResult < ( ) > {
1417
- let attr_name = attr_name. into_pystr_ref ( self ) ;
1418
- obj. call_set_attr ( self , attr_name, None )
1419
- }
1420
-
1421
1416
// get_method should be used for internal access to magic methods (by-passing
1422
1417
// the full getattribute look-up.
1423
1418
pub fn get_method_or_type_error < F > (
You can’t perform that action at this time.
0 commit comments