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

Method validate_new_args

crates/stdlib/src/mmap.rs:343–351  ·  view source on GitHub ↗

Validate mmap constructor arguments

(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

341 impl MmapNewArgs {
342 /// Validate mmap constructor arguments
343 fn validate_new_args(&self, vm: &VirtualMachine) -> PyResult<usize> {
344 if self.length < 0 {
345 return Err(vm.new_overflow_error("memory mapped length must be positive"));
346 }
347 if self.offset < 0 {
348 return Err(vm.new_overflow_error("memory mapped offset must be positive"));
349 }
350 Ok(self.length as usize)
351 }
352 }
353
354 #[derive(FromArgs)]

Callers 1

py_newMethod · 0.80

Calls 1

ErrClass · 0.50

Tested by

no test coverage detected