(args: GetsizeofArgs, vm: &VirtualMachine)
| 963 | |
| 964 | #[pyfunction] |
| 965 | fn getsizeof(args: GetsizeofArgs, vm: &VirtualMachine) -> PyResult { |
| 966 | let sizeof = || -> PyResult<usize> { |
| 967 | let res = vm.call_special_method(&args.obj, identifier!(vm, __sizeof__), ())?; |
| 968 | let res = res.try_index(vm)?.try_to_primitive::<usize>(vm)?; |
| 969 | Ok(res + core::mem::size_of::<PyObject>()) |
| 970 | }; |
| 971 | sizeof() |
| 972 | .map(|x| vm.ctx.new_int(x).into()) |
| 973 | .or_else(|err| args.default.ok_or(err)) |
| 974 | } |
| 975 | |
| 976 | #[pyfunction] |
| 977 | fn getfilesystemencoding(vm: &VirtualMachine) -> PyStrRef { |
nothing calls this directly
no test coverage detected