@@ -339,34 +339,12 @@ fn argument_introspection_data<'a>(
339339 params. insert ( "annotation" , IntrospectionNode :: String ( annotation. into ( ) ) ) ;
340340 } else if desc. from_py_with . is_none ( ) {
341341 // If from_py_with is set we don't know anything on the input type
342- if let Some ( ty) = desc. option_wrapped_type {
343- // Special case to properly generate a `T | None` annotation
344- let mut ty = ty. clone ( ) ;
345- if let Some ( class_type) = class_type {
346- replace_self ( & mut ty, class_type) ;
347- }
348- elide_lifetimes ( & mut ty) ;
349- params. insert (
350- "annotation" ,
351- IntrospectionNode :: InputType {
352- rust_type : ty,
353- nullable : true ,
354- } ,
355- ) ;
356- } else {
357- let mut ty = desc. ty . clone ( ) ;
358- if let Some ( class_type) = class_type {
359- replace_self ( & mut ty, class_type) ;
360- }
361- elide_lifetimes ( & mut ty) ;
362- params. insert (
363- "annotation" ,
364- IntrospectionNode :: InputType {
365- rust_type : ty,
366- nullable : false ,
367- } ,
368- ) ;
342+ let mut ty = desc. ty . clone ( ) ;
343+ if let Some ( class_type) = class_type {
344+ replace_self ( & mut ty, class_type) ;
369345 }
346+ elide_lifetimes ( & mut ty) ;
347+ params. insert ( "annotation" , IntrospectionNode :: InputType ( ty) ) ;
370348 }
371349 IntrospectionNode :: Map ( params) . into ( )
372350}
@@ -375,7 +353,7 @@ enum IntrospectionNode<'a> {
375353 String ( Cow < ' a , str > ) ,
376354 Bool ( bool ) ,
377355 IntrospectionId ( Option < Cow < ' a , Type > > ) ,
378- InputType { rust_type : Type , nullable : bool } ,
356+ InputType ( Type ) ,
379357 OutputType { rust_type : Type , is_final : bool } ,
380358 ConstantType ( PythonIdentifier ) ,
381359 Map ( HashMap < & ' static str , IntrospectionNode < ' a > > ) ,
@@ -411,11 +389,8 @@ impl IntrospectionNode<'_> {
411389 } ) ;
412390 content. push_str ( "\" " ) ;
413391 }
414- Self :: InputType {
415- rust_type,
416- nullable,
417- } => {
418- let mut annotation = quote ! {
392+ Self :: InputType ( rust_type) => {
393+ let annotation = quote ! {
419394 <#rust_type as #pyo3_crate_path:: impl_:: extract_argument:: PyFunctionArgument <
420395 {
421396 #[ allow( unused_imports, reason = "`Probe` trait used on negative case only" ) ]
@@ -424,9 +399,6 @@ impl IntrospectionNode<'_> {
424399 }
425400 >>:: INPUT_TYPE
426401 } ;
427- if nullable {
428- annotation = quote ! { #pyo3_crate_path:: inspect:: TypeHint :: union ( & [ #annotation, #pyo3_crate_path:: inspect:: TypeHint :: builtin( "None" ) ] ) } ;
429- }
430402 content. push_tokens ( serialize_type_hint ( annotation, pyo3_crate_path) ) ;
431403 }
432404 Self :: OutputType {
0 commit comments