You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just looking at #4748, and the compile error on invalid from_py_with function.
I wonder if we can somehow wrap the function up in a trait and then use diagnostic::on_unimplemented to give a more user-friendly error message for that case? 🤔
The text was updated successfully, but these errors were encountered:
let ret = function(::pyo3::impl_::extract_argument::from_py_with(unsafe{::pyo3::impl_::extract_argument::unwrap_required_argument(output[0usize].as_deref())},"bytes",
from_py_with_0 asfn(_) -> _,)?);
If you use a type annotation rather than an as cast, like
let from_py_with_0:fn(_) -> _ = from_py_with_0;let ret = function(::pyo3::impl_::extract_argument::from_py_with(unsafe{::pyo3::impl_::extract_argument::unwrap_required_argument(output[0usize].as_deref())},"bytes",
from_py_with_0,)?);
I wonder if we can somehow wrap the function up in a trait and then use diagnostic::on_unimplemented
I'm not a fan of this approach, it seems like a better fix for this sort of thing is to make changes in the compiler itself to make this kind of error message better.
Just looking at #4748, and the compile error on invalid
from_py_with
function.I wonder if we can somehow wrap the function up in a trait and then use
diagnostic::on_unimplemented
to give a more user-friendly error message for that case? 🤔The text was updated successfully, but these errors were encountered: