Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vm/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ impl ExecutingFrame<'_> {
fn delete_attr(&mut self, vm: &VirtualMachine, attr: bytecode::NameIdx) -> FrameResult {
let attr_name = self.code.names[attr as usize].clone();
let parent = self.pop_value();
vm.del_attr(&parent, attr_name)?;
parent.del_attr(attr_name, vm)?;
Ok(None)
}

Expand Down
3 changes: 2 additions & 1 deletion vm/src/protocol/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ impl PyObjectRef {
// int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value)

pub fn del_attr(&self, attr_name: impl IntoPyStrRef, vm: &VirtualMachine) -> PyResult<()> {
vm.del_attr(self, attr_name)
let attr_name = attr_name.into_pystr_ref(vm);
self.call_set_attr(vm, attr_name, None)
}

// PyObject *PyObject_GenericGetDict(PyObject *o, void *context)
Expand Down
2 changes: 1 addition & 1 deletion vm/src/stdlib/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ mod builtins {

#[pyfunction]
fn delattr(obj: PyObjectRef, attr: PyStrRef, vm: &VirtualMachine) -> PyResult<()> {
vm.del_attr(&obj, attr)
obj.del_attr(attr, vm)
}

#[pyfunction]
Expand Down
5 changes: 0 additions & 5 deletions vm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,6 @@ impl VirtualMachine {
}
}

pub fn del_attr(&self, obj: &PyObjectRef, attr_name: impl IntoPyStrRef) -> PyResult<()> {
let attr_name = attr_name.into_pystr_ref(self);
obj.call_set_attr(self, attr_name, None)
}

// get_method should be used for internal access to magic methods (by-passing
// the full getattribute look-up.
pub fn get_method_or_type_error<F>(
Expand Down