(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine)
| 409 | } |
| 410 | |
| 411 | fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> { |
| 412 | match args.object { |
| 413 | OptionalArg::Present(input) => { |
| 414 | if let OptionalArg::Present(enc) = args.encoding { |
| 415 | let s = vm.state.codec_registry.decode_text( |
| 416 | input, |
| 417 | enc.as_str(), |
| 418 | args.errors.into_option(), |
| 419 | vm, |
| 420 | )?; |
| 421 | Ok(Self::from(s.as_wtf8().to_owned())) |
| 422 | } else { |
| 423 | let s = input.str(vm)?; |
| 424 | Ok(Self::from(s.as_wtf8().to_owned())) |
| 425 | } |
| 426 | } |
| 427 | OptionalArg::Missing => Ok(Self::from(String::new())), |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | impl PyStr { |
nothing calls this directly
no test coverage detected