azure-functions-python-worker
azure-functions-python-worker copied to clipboard
fix: update typing inspect get_origin check
Description
Previously, this was the check in get_function_return_type:
if typing_inspect.is_generic_type(
return_anno) and typing_inspect.get_origin(
return_anno).__name__ == 'Out':
If typing_inspect.get_origin(return_anno) returned None, there would be an error thrown saying AttributeError: 'NoneType' object has no attribute '__name__'.
This change introduces a new check to ensure that typing_inspect.get_origin(return_anno) is not None before checking the __name__ property.
Fixes https://github.com/Azure/azure-functions-python-worker/issues/1688
PR information
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, see this page.
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made and CI is passing.
Quality of Code and Contribution Guidelines
- [ ] I have read the contribution guidelines.