Skip to content
Prev Previous commit
Next Next commit
Validate maxvalue > 0 in SemLock and document winerror __reduce__ div…
…ergence
  • Loading branch information
youknowone committed Feb 23, 2026
commit c7d65b9a5ba9e3bef69fe47ba2c8008fc1203fff
3 changes: 3 additions & 0 deletions crates/stdlib/src/multiprocessing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ mod _multiprocessing {
if args.kind != RECURSIVE_MUTEX && args.kind != SEMAPHORE {
return Err(vm.new_value_error("unrecognized kind".to_owned()));
}
if args.maxvalue <= 0 {
return Err(vm.new_value_error("maxvalue must be positive".to_owned()));
}
if args.value < 0 || args.value > args.maxvalue {
return Err(vm.new_value_error("invalid value".to_owned()));
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Expand Down
2 changes: 2 additions & 0 deletions crates/vm/src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,8 @@ pub(super) mod types {
args_reduced.push(vm.ctx.none());
args_reduced.push(filename2);
} else {
// Diverges from CPython: include winerror even without
// filename2 so it survives pickle round-trips.
#[cfg(windows)]
if let Some(winerror) = winerror {
args_reduced.push(winerror);
Expand Down
Loading