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

Method from

src/err.rs:448–457  ·  view source on GitHub ↗
(err: PythonObjectDowncastError<'p>)

Source from the content-addressed store, hash-verified

446/// Converts `PythonObjectDowncastError` to Python `TypeError`.
447impl<'p> std::convert::From<PythonObjectDowncastError<'p>> for PyErr {
448 fn from(err: PythonObjectDowncastError<'p>) -> PyErr {
449 let msg = format!(
450 "Expected type that converts to {} but received {}",
451 err.expected_type_name,
452 err.received_type.name(err.py),
453 )
454 .to_py_object(err.py)
455 .into_object();
456 PyErr::new_lazy_init(err.py.get_type::<exc::TypeError>(), Some(msg))
457 }
458}
459
460/// Construct PyObject from the result of a Python FFI call that returns a new reference (owned pointer).

Callers

nothing calls this directly

Calls 2

into_objectMethod · 0.45
to_py_objectMethod · 0.45

Tested by

no test coverage detected