MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / wrong_tuple_length

Function wrong_tuple_length

src/objects/tuple.rs:96–106  ·  view source on GitHub ↗
(py: Python, t: &PyTuple, expected_length: usize)

Source from the content-addressed store, hash-verified

94}
95
96fn wrong_tuple_length(py: Python, t: &PyTuple, expected_length: usize) -> PyErr {
97 let msg = format!(
98 "Expected tuple of length {}, but got tuple of length {}.",
99 expected_length,
100 t.len(py)
101 );
102 PyErr::new_lazy_init(
103 py.get_type::<exc::ValueError>(),
104 Some(msg.to_py_object(py).into_object()),
105 )
106}
107
108macro_rules! tuple_conversion ({$length:expr,$(($refN:ident, $n:tt, $T:ident)),+} => {
109 /// Converts a Rust tuple to a Python `tuple`.

Callers

nothing calls this directly

Calls 2

into_objectMethod · 0.45
to_py_objectMethod · 0.45

Tested by

no test coverage detected