Skip to content

fix: update typing inspect get_origin check #1691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Jun 2, 2025

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 #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Opportunistic code in get_function_return_type.
1 participant