File tree 2 files changed +14
-1
lines changed 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(
265
265
) ?
266
266
}
267
267
} else {
268
+ let unwrap = quote ! { unsafe { #pyo3_path:: impl_:: extract_argument:: unwrap_required_argument( #arg_value) } } ;
268
269
quote_arg_span ! {
269
270
#pyo3_path:: impl_:: extract_argument:: from_py_with(
270
- #pyo3_path :: impl_ :: extract_argument :: unwrap_required_argument ( #arg_value ) ,
271
+ #unwrap ,
271
272
#name_str,
272
273
#from_py_with as fn ( _) -> _,
273
274
) ?
Original file line number Diff line number Diff line change @@ -28,4 +28,16 @@ mod gh_4394 {
28
28
pub struct Version ;
29
29
}
30
30
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
+
31
43
fn main ( ) { }
You can’t perform that action at this time.
0 commit comments