MCPcopy Index your code
hub / github.com/RustPython/RustPython / py_new

Method py_new

crates/stdlib/src/zlib.rs:574–587  ·  view source on GitHub ↗
(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

572 type Args = DecompressobjArgs;
573
574 fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
575 let mut decompress = InitOptions::new(args.wbits.value, vm)?.decompress();
576 let zdict = args.zdict.into_option();
577 if let Some(dict) = &zdict
578 && args.wbits.value < 0
579 {
580 dict.with_ref(|d| decompress.set_dictionary(d))
581 .map_err(|_| new_zlib_error("failed to set dictionary", vm))?;
582 }
583 let inner = DecompressState::new(DecompressWithDict { decompress, zdict }, vm);
584 Ok(Self {
585 inner: PyMutex::new(inner),
586 })
587 }
588 }
589
590 #[pyclass(with(Constructor))]

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
new_zlib_errorFunction · 0.85
into_optionMethod · 0.80
with_refMethod · 0.80
decompressMethod · 0.45

Tested by

no test coverage detected