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

get_type_hints() should support functools.partial() #3478

Closed
Zac-HD opened this issue Oct 17, 2022 · 0 comments · Fixed by #3536
Closed

get_type_hints() should support functools.partial() #3478

Zac-HD opened this issue Oct 17, 2022 · 0 comments · Fixed by #3536
Labels
enhancement it's not broken, but we want it to be better

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Oct 17, 2022

Our get_type_hints() helper doesn't currently support functools.partial(), but I think it should - it's easy enough to detect, recurse on the wrapped callable, and then drop any bound-positional args (bound kwargs just assign a default value).

We should also consider upstreaming this fix into typing.get_type_hints(), since inspect.signature() does this already.

@Zac-HD Zac-HD added the enhancement it's not broken, but we want it to be better label Oct 17, 2022
@Zac-HD Zac-HD mentioned this issue Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement it's not broken, but we want it to be better
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant