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

Method with_filename

crates/vm/src/ospath.rs:319–329  ·  view source on GitHub ↗
(
        error: &std::io::Error,
        filename: impl Into<OsPathOrFd<'a>>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

317impl crate::exceptions::OSErrorBuilder {
318 #[must_use]
319 pub(crate) fn with_filename<'a>(
320 error: &std::io::Error,
321 filename: impl Into<OsPathOrFd<'a>>,
322 vm: &VirtualMachine,
323 ) -> crate::builtins::PyBaseExceptionRef {
324 // TODO: return type to PyRef<PyOSError>
325 use crate::exceptions::ToOSErrorBuilder;
326 let builder = error.to_os_error_builder(vm);
327 let builder = builder.filename(filename.into().filename(vm));
328 builder.build(vm).upcast()
329 }
330
331 /// Like `with_filename`, but strips winerror on Windows.
332 /// Use for C runtime errors (open, fstat, etc.) that should produce

Callers

nothing calls this directly

Calls 4

to_os_error_builderMethod · 0.80
upcastMethod · 0.80
filenameMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected