File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -265,9 +265,10 @@ pub(crate) fn impl_regular_arg_param(
265265 ) ?
266266 }
267267 } else {
268+ let unwrap = quote ! { unsafe { #pyo3_path:: impl_:: extract_argument:: unwrap_required_argument( #arg_value) } } ;
268269 quote_arg_span ! {
269270 #pyo3_path:: impl_:: extract_argument:: from_py_with(
270- #pyo3_path :: impl_ :: extract_argument :: unwrap_required_argument ( #arg_value ) ,
271+ #unwrap ,
271272 #name_str,
272273 #from_py_with as fn ( _) -> _,
273274 ) ?
Original file line number Diff line number Diff line change @@ -28,4 +28,16 @@ mod gh_4394 {
2828 pub struct Version ;
2929}
3030
31+ mod from_py_with {
32+ use pyo3:: prelude:: * ;
33+ use pyo3:: types:: PyBytes ;
34+
35+ fn bytes_from_py ( bytes : & Bound < ' _ , PyAny > ) -> PyResult < Vec < u8 > > {
36+ Ok ( bytes. downcast :: < PyBytes > ( ) ?. as_bytes ( ) . to_vec ( ) )
37+ }
38+
39+ #[ pyfunction]
40+ fn f ( #[ pyo3( from_py_with = "bytes_from_py" ) ] _bytes : Vec < u8 > ) { }
41+ }
42+
3143fn main ( ) { }
You can’t perform that action at this time.
0 commit comments