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

Function write

crates/vm/src/stdlib/os.rs:324–337  ·  view source on GitHub ↗
(fd: crt_fd::Borrowed<'_>, data: ArgBytesLike, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

322
323 #[pyfunction]
324 fn write(fd: crt_fd::Borrowed<'_>, data: ArgBytesLike, vm: &VirtualMachine) -> PyResult<usize> {
325 data.with_ref(|b| {
326 loop {
327 match vm.allow_threads(|| crt_fd::write(fd, b)) {
328 Ok(n) => return Ok(n),
329 Err(e) if e.raw_os_error() == Some(libc::EINTR) => {
330 vm.check_signals()?;
331 continue;
332 }
333 Err(e) => return Err(e.into_pyexception(vm)),
334 }
335 }
336 })
337 }
338
339 #[cfg(not(windows))]
340 #[pyfunction]

Callers 7

printFunction · 0.70
run_signalFunction · 0.70
writeMethod · 0.70
fmtMethod · 0.50
stw_traceFunction · 0.50
new_refMethod · 0.50
init_type_hierarchyFunction · 0.50

Calls 6

with_refMethod · 0.80
allow_threadsMethod · 0.80
check_signalsMethod · 0.80
SomeClass · 0.50
ErrClass · 0.50
into_pyexceptionMethod · 0.45

Tested by

no test coverage detected