We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f9161d commit 0843d2cCopy full SHA for 0843d2c
blacksheep/utils/meta.py
@@ -33,7 +33,7 @@ def import_child_modules(root_path: Path):
33
34
def clonefunc(func):
35
"""
36
- Clone a function, preserving its name and docstring.
+ Clone a function, preserving its name, docstring, annotations and kwdefaults.
37
38
new_func = func.__class__(
39
func.__code__,
@@ -44,6 +44,9 @@ def clonefunc(func):
44
)
45
new_func.__doc__ = func.__doc__
46
new_func.__dict__ = copy.deepcopy(func.__dict__)
47
+ new_func.__annotations__ = copy.deepcopy(func.__annotations__)
48
+ if func.__kwdefaults__:
49
+ new_func.__kwdefaults__ = copy.deepcopy(func.__kwdefaults__)
50
return new_func
51
52
0 commit comments