Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Base macro
  • Loading branch information
ShaharNaveh committed Jun 3, 2026
commit aa60e4c677920281b4a1a3a88d92ae574eadb91e
15 changes: 15 additions & 0 deletions crates/vm/src/protocol/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,3 +826,18 @@ impl PyObject {
}
}
}

/// Macro to reduce code repition when setting multiple attributes on an object.
#[macro_export]
macro_rules! set_attrs {
($obj:expr, $vm:expr, unwrap, $($key:expr => $val:expr),+ $(,)?) => {
$(
$obj.set_attr($key, $val, $vm).unwrap();
)+
};
($obj:expr, $vm:expr, $($key:expr => $val:expr),+ $(,)?) => {
$(
$obj.set_attr($key, $val, $vm)?;
)+
};
}