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

Function dup

crates/stdlib/src/socket.rs:3422–3430  ·  view source on GitHub ↗
(x: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

3420
3421 #[pyfunction]
3422 fn dup(x: PyObjectRef, vm: &VirtualMachine) -> Result<RawSocket, IoOrPyException> {
3423 let sock = get_raw_sock(x, vm)?;
3424 let sock = core::mem::ManuallyDrop::new(sock_from_raw(sock, vm)?);
3425 let newsock = sock.try_clone()?;
3426 let fd = into_sock_fileno(newsock);
3427 #[cfg(windows)]
3428 crate::vm::stdlib::nt::raw_set_handle_inheritable(fd as _, false)?;
3429 Ok(fd)
3430 }
3431
3432 #[pyfunction]
3433 fn close(x: PyObjectRef, vm: &VirtualMachine) -> Result<(), IoOrPyException> {

Callers 2

py_newMethod · 0.70
exec_innerFunction · 0.70

Calls 5

get_raw_sockFunction · 0.85
newFunction · 0.85
sock_from_rawFunction · 0.85
into_sock_filenoFunction · 0.85

Tested by

no test coverage detected