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

Function dup

crates/vm/src/stdlib/posix.rs:2034–2039  ·  view source on GitHub ↗
(fd: BorrowedFd<'_>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

2032
2033 #[pyfunction]
2034 fn dup(fd: BorrowedFd<'_>, vm: &VirtualMachine) -> PyResult<OwnedFd> {
2035 let fd = nix::unistd::dup(fd).map_err(|e| e.into_pyexception(vm))?;
2036 super::set_inheritable(fd.as_fd(), false)
2037 .map(|()| fd)
2038 .map_err(|e| e.into_pyexception(vm))
2039 }
2040
2041 #[derive(FromArgs)]
2042 struct Dup2Args<'fd> {

Callers

nothing calls this directly

Calls 4

set_inheritableFunction · 0.70
into_pyexceptionMethod · 0.45
mapMethod · 0.45
as_fdMethod · 0.45

Tested by

no test coverage detected