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

Function field_size_limit

crates/stdlib/src/csv.rs:350–365  ·  view source on GitHub ↗
(rest: FuncArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

348
349 #[pyfunction]
350 fn field_size_limit(rest: FuncArgs, vm: &VirtualMachine) -> PyResult<isize> {
351 let old_size = GLOBAL_FIELD_LIMIT.lock().to_owned();
352 if !rest.args.is_empty() {
353 let arg_len = rest.args.len();
354 if arg_len != 1 {
355 return Err(vm.new_type_error(format!(
356 "field_size_limit() takes at most 1 argument ({arg_len} given)"
357 )));
358 }
359 let Ok(new_size) = rest.args.first().unwrap().try_int(vm) else {
360 return Err(vm.new_type_error("limit must be an integer"));
361 };
362 *GLOBAL_FIELD_LIMIT.lock() = new_size.try_to_primitive::<isize>(vm)?;
363 }
364 Ok(old_size)
365 }
366
367 #[pyfunction]
368 fn reader(

Callers

nothing calls this directly

Calls 8

try_intMethod · 0.80
ErrClass · 0.50
to_ownedMethod · 0.45
lockMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45
unwrapMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected