Skip to content

Commit e10a716

Browse files
authored
Merge pull request #72 from gschaffner/fix-takes_callable_and_args-TypeVar-binding
Fix `@takes_callable_and_args` `TypeVar` binding bug
2 parents 6cefb0b + cd5ee76 commit e10a716

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

trio_typing/plugin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,11 @@ def start_soon(
463463
+ ([None] * len(type_var_types))
464464
+ callable_ty.arg_names[callable_args_idx + 1 :]
465465
),
466-
variables=(
467-
list(callable_ty.variables)
468-
+ cast(List[TypeVarLikeType], type_var_types)
469-
),
466+
# Note that we do *not* append `type_var_types` to
467+
# `callable_ty.variables`. Even though `*type_var_types` are in our new
468+
# `callable_ty`'s argument types, they are *not* type variables that get
469+
# bound when our new `callable_ty` gets called. They get bound when the
470+
# `expanded_fn` that references our new `callable_ty` gets called.
470471
)
471472
expanded_fns.append(
472473
fn_type.copy_modified(

0 commit comments

Comments
 (0)