(obj: PyObjectRef, attr: PyObjectRef, vm: &VirtualMachine)
| 444 | |
| 445 | #[pyfunction] |
| 446 | fn delattr(obj: PyObjectRef, attr: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |
| 447 | let attr = attr.try_to_ref::<PyStr>(vm).map_err(|_e| { |
| 448 | vm.new_type_error(format!( |
| 449 | "attribute name must be string, not '{}'", |
| 450 | attr.class().name() |
| 451 | )) |
| 452 | })?; |
| 453 | obj.del_attr(attr, vm) |
| 454 | } |
| 455 | |
| 456 | #[pyfunction] |
| 457 | fn dir(obj: OptionalArg<PyObjectRef>, vm: &VirtualMachine) -> PyResult<PyList> { |