Skip to content

Commit

Permalink
(wip) fix: name 'Response' is not defined
Browse files Browse the repository at this point in the history
Aim to resolve #69
  • Loading branch information
zhangcheng authored and alecthomas committed May 31, 2022
1 parent a9fbf1c commit 4d8bfe8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions flask_injector/__init__.py
Expand Up @@ -62,15 +62,13 @@ def wrap_fun(fun: T, injector: Injector) -> T:
if hasattr(fun, '__call__') and not isinstance(fun, type):
try:
type_hints = get_type_hints(fun)
except (AttributeError, TypeError):
except (AttributeError, TypeError, NameError):
# Some callables aren't introspectable with get_type_hints,
# let's assume they don't have anything to inject. The exception
# types handled here are what I encountered so far.
# It used to be AttributeError, then https://github.com/python/typing/pull/314
# changed it to TypeError.
wrap_it = False
except NameError:
wrap_it = True
else:
type_hints.pop('return', None)
wrap_it = type_hints != {}
Expand Down

0 comments on commit 4d8bfe8

Please sign in to comment.