Skip to content

Commit 0b3d9a3

Browse files
committed
Fix handling of output annotations with generics under Python 3.7
1 parent 9b8a8bb commit 0b3d9a3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

azure/functions_worker/bindings/queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class QueueMessageOutConverter(meta.OutConverter, binding='queue'):
102102
def check_output_type_annotation(cls, pytype: type) -> bool:
103103
valid_types = (azf_abc.QueueMessage, str, bytes)
104104
return (
105-
issubclass(pytype, valid_types) or
106-
meta.is_iterable_type_annotation(pytype, valid_types)
105+
meta.is_iterable_type_annotation(pytype, valid_types) or
106+
(isinstance(pytype, type) and issubclass(pytype, valid_types))
107107
)
108108

109109
@classmethod

azure/functions_worker/functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def add_function(self, function_id: str,
151151
else:
152152
param_py_type = param_anno
153153

154-
if param_has_anno and not isinstance(param_py_type, type):
154+
if (param_has_anno and not isinstance(param_py_type, type) and
155+
not typing_inspect.is_generic_type(param_py_type)):
155156
raise FunctionLoadError(
156157
func_name,
157158
f'binding {param.name} has invalid non-type annotation '

0 commit comments

Comments
 (0)