Skip to content
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

[Utils] Handled Callable in tir.schedule._type_checker #12633

Merged
merged 1 commit into from
Aug 29, 2022

Conversation

Lunderberg
Copy link
Contributor

Previously, Callable was handled as an atomic type. This worked when it was included as last element of a Union[] annotation with no subtypes, but raised an error for other use cases, including Optional[Callable].

This commit adds explicit checks for Callable type annotations to validate whether the argument is callable, but doesn't recursively validate the signature of the callable object, because lambda functions cannot have type annotations. (https://peps.python.org/pep-3107/#lambda)

Previously, `Callable` was handled as an atomic type.  This worked
when it was included as last element of a `Union[]` annotation with no
subtypes, but raised an error for other use cases, including
`Optional[Callable]`.

This commit adds explicit checks for `Callable` type annotations to
validate whether the argument is callable, but doesn't recursively
validate the signature of the callable object, because lambda
functions cannot have type
annotations. (https://peps.python.org/pep-3107/#lambda)
@vinx13 vinx13 merged commit 74988d3 into apache:main Aug 29, 2022
@Lunderberg Lunderberg deleted the type_check_callable branch August 30, 2022 13:05
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
Previously, `Callable` was handled as an atomic type.  This worked
when it was included as last element of a `Union[]` annotation with no
subtypes, but raised an error for other use cases, including
`Optional[Callable]`.

This commit adds explicit checks for `Callable` type annotations to
validate whether the argument is callable, but doesn't recursively
validate the signature of the callable object, because lambda
functions cannot have type
annotations. (https://peps.python.org/pep-3107/#lambda)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants