MCPcopy Create free account
hub / github.com/RustPython/RustPython / from_pyc_path

Method from_pyc_path

crates/vm/src/builtins/code.rs:430–443  ·  view source on GitHub ↗
(path: &std::path::Path, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

428 );
429 }
430 pub fn from_pyc_path(path: &std::path::Path, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
431 let name = match path.file_stem() {
432 Some(stem) => stem.display().to_string(),
433 None => "".to_owned(),
434 };
435 let content = std::fs::read(path).map_err(|e| e.to_pyexception(vm))?;
436 Self::from_pyc(
437 &content,
438 Some(&name),
439 Some(&path.display().to_string()),
440 Some("<source>"),
441 vm,
442 )
443 }
444 pub fn from_pyc(
445 pyc_bytes: &[u8],
446 name: Option<&str>,

Callers

nothing calls this directly

Calls 6

to_stringMethod · 0.80
readFunction · 0.50
SomeClass · 0.50
displayMethod · 0.45
to_ownedMethod · 0.45
to_pyexceptionMethod · 0.45

Tested by

no test coverage detected