PyObject *PyObject_Dir(PyObject *o)
(self, vm: &VirtualMachine)
| 58 | |
| 59 | // PyObject *PyObject_Dir(PyObject *o) |
| 60 | pub fn dir(self, vm: &VirtualMachine) -> PyResult<PyList> { |
| 61 | let attributes = self.class().get_attributes(); |
| 62 | |
| 63 | let dict = PyDict::from_attributes(attributes, vm)?.into_ref(&vm.ctx); |
| 64 | |
| 65 | if let Some(object_dict) = self.dict() { |
| 66 | vm.call_method( |
| 67 | dict.as_object(), |
| 68 | identifier!(vm, update).as_str(), |
| 69 | (object_dict,), |
| 70 | )?; |
| 71 | } |
| 72 | |
| 73 | let attributes: Vec<_> = dict.into_iter().map(|(k, _v)| k).collect(); |
| 74 | |
| 75 | Ok(PyList::from(attributes)) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | impl PyObject { |
nothing calls this directly
no test coverage detected