Skip to content

Commit 1ab1cb2

Browse files
tdsmithTinche
authored andcommitted
Fix signature for generic structure hooks
A generic structure hook is expected to return a value of the type that it accepts as an argument.
1 parent 3a02a04 commit 1ab1cb2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cattr/converters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def register_unstructure_hook_func(
169169
self._unstructure_func.register_func_list([(check_func, func)])
170170

171171
def register_structure_hook(
172-
self, cl: Type[T], func: Callable[[Any, Type[V]], T]
172+
self, cl: Type[T], func: Callable[[Any, Type[T]], T]
173173
):
174174
"""Register a primitive-to-class converter function for a type.
175175
@@ -188,7 +188,7 @@ def register_structure_hook(
188188
def register_structure_hook_func(
189189
self,
190190
check_func: Callable[[Type[T]], bool],
191-
func: Callable[[Any, Type[V]], T],
191+
func: Callable[[Any, Type[T]], T],
192192
):
193193
"""Register a class-to-primitive converter function for a class, using
194194
a function to check if it's a match.

0 commit comments

Comments
 (0)