@@ -332,34 +332,12 @@ fn argument_introspection_data<'a>(
332332 params. insert ( "annotation" , IntrospectionNode :: String ( annotation. into ( ) ) ) ;
333333 } else if desc. from_py_with . is_none ( ) {
334334 // If from_py_with is set we don't know anything on the input type
335- if let Some ( ty) = desc. option_wrapped_type {
336- // Special case to properly generate a `T | None` annotation
337- let mut ty = ty. clone ( ) ;
338- if let Some ( class_type) = class_type {
339- replace_self ( & mut ty, class_type) ;
340- }
341- elide_lifetimes ( & mut ty) ;
342- params. insert (
343- "annotation" ,
344- IntrospectionNode :: InputType {
345- rust_type : ty,
346- nullable : true ,
347- } ,
348- ) ;
349- } else {
350- let mut ty = desc. ty . clone ( ) ;
351- if let Some ( class_type) = class_type {
352- replace_self ( & mut ty, class_type) ;
353- }
354- elide_lifetimes ( & mut ty) ;
355- params. insert (
356- "annotation" ,
357- IntrospectionNode :: InputType {
358- rust_type : ty,
359- nullable : false ,
360- } ,
361- ) ;
335+ let mut ty = desc. ty . clone ( ) ;
336+ if let Some ( class_type) = class_type {
337+ replace_self ( & mut ty, class_type) ;
362338 }
339+ elide_lifetimes ( & mut ty) ;
340+ params. insert ( "annotation" , IntrospectionNode :: InputType ( ty) ) ;
363341 }
364342 IntrospectionNode :: Map ( params) . into ( )
365343}
@@ -368,7 +346,7 @@ enum IntrospectionNode<'a> {
368346 String ( Cow < ' a , str > ) ,
369347 Bool ( bool ) ,
370348 IntrospectionId ( Option < Cow < ' a , Type > > ) ,
371- InputType { rust_type : Type , nullable : bool } ,
349+ InputType ( Type ) ,
372350 OutputType { rust_type : Type , is_final : bool } ,
373351 ConstantType ( PythonIdentifier ) ,
374352 Map ( HashMap < & ' static str , IntrospectionNode < ' a > > ) ,
@@ -404,11 +382,8 @@ impl IntrospectionNode<'_> {
404382 } ) ;
405383 content. push_str ( "\" " ) ;
406384 }
407- Self :: InputType {
408- rust_type,
409- nullable,
410- } => {
411- let mut annotation = quote ! {
385+ Self :: InputType ( rust_type) => {
386+ let annotation = quote ! {
412387 <#rust_type as #pyo3_crate_path:: impl_:: extract_argument:: PyFunctionArgument <
413388 {
414389 #[ allow( unused_imports, reason = "`Probe` trait used on negative case only" ) ]
@@ -417,9 +392,6 @@ impl IntrospectionNode<'_> {
417392 }
418393 >>:: INPUT_TYPE
419394 } ;
420- if nullable {
421- annotation = quote ! { #pyo3_crate_path:: inspect:: TypeHint :: union ( & [ #annotation, #pyo3_crate_path:: inspect:: TypeHint :: builtin( "None" ) ] ) } ;
422- }
423395 content. push_tokens ( serialize_type_hint ( annotation, pyo3_crate_path) ) ;
424396 }
425397 Self :: OutputType {
0 commit comments