Fix ctxmanager injects hash

This commit is contained in:
2025-08-16 18:44:58 +03:00
parent d6f8038efa
commit 3150c4b2d0
2 changed files with 4 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ class ConversionPoint:
raise ValueError(f'Function {func.__qualname__} provided as injector, but return-type is not specified')
rettype_origin = get_origin(rettype)
fn_rettype_origin = get_origin(fn_rettype)
cm_out_origins = [
typing.Generator,
typing.Iterator,
@@ -83,6 +84,8 @@ class ConversionPoint:
]
if any(map(lambda x: rettype_origin is x, cm_out_origins)) and is_context_manager_factory(func):
rettype = get_args(rettype)[0]
if any(map(lambda x: fn_rettype_origin is x, cm_out_origins)) and is_context_manager_factory(func):
fn_rettype = get_args(fn_rettype)[0]
if is_basic_type_annot(rettype):
return []

View File

@@ -146,7 +146,7 @@ class InTimeGenerationConvertorRenderer(ConvertorRenderer):
conversion_models = deduplicate_callseq(conversion_models)
ret_hash = hashname(callseq[-1].injects)
ret_hash = hashname(callseq[-1].rettype)
conv_args = []
for i, from_type in enumerate(from_types):