(_cls: &Py<PyType>, ctx: Self::Args, vm: &VirtualMachine)
| 57 | type Args = PyObjectRef; |
| 58 | |
| 59 | fn py_new(_cls: &Py<PyType>, ctx: Self::Args, vm: &VirtualMachine) -> PyResult<Self> { |
| 60 | let strict = ctx.get_attr("strict", vm)?.try_to_bool(vm)?; |
| 61 | let object_hook = vm.option_if_none(ctx.get_attr("object_hook", vm)?); |
| 62 | let object_pairs_hook = vm.option_if_none(ctx.get_attr("object_pairs_hook", vm)?); |
| 63 | let parse_float = ctx.get_attr("parse_float", vm)?; |
| 64 | let parse_float = if vm.is_none(&parse_float) || parse_float.is(vm.ctx.types.float_type) |
| 65 | { |
| 66 | None |
| 67 | } else { |
| 68 | Some(parse_float) |
| 69 | }; |
| 70 | let parse_int = ctx.get_attr("parse_int", vm)?; |
| 71 | let parse_int = if vm.is_none(&parse_int) || parse_int.is(vm.ctx.types.int_type) { |
| 72 | None |
| 73 | } else { |
| 74 | Some(parse_int) |
| 75 | }; |
| 76 | let parse_constant = ctx.get_attr("parse_constant", vm)?; |
| 77 | |
| 78 | Ok(Self { |
| 79 | strict, |
| 80 | object_hook, |
| 81 | object_pairs_hook, |
| 82 | parse_float, |
| 83 | parse_int, |
| 84 | parse_constant, |
| 85 | ctx, |
| 86 | }) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | #[pyclass(with(Callable, Constructor))] |
nothing calls this directly
no test coverage detected