-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(types): add support for typing.Literal type #5192
Conversation
include/pybind11/typing.h
Outdated
char name[N]; | ||
}; | ||
|
||
// NOTE: C++ implemented constant template Literal[1, 2] does not equal Literal[2, 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be simplified?
// NOTE: Literal[1, 2] does not equal Literal[2, 1]
But why is this noteworthy here? (IOW, where/why does it matter?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops this comment was left from a previous implementation. It has now been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge it as soon as I see that the GHA are done.
Don't worry about this failure: Pip / 🐍 3.8 • 📦 & 📦 tests • ubuntu-latest It's just some kind of infrastructure hiccup that we can safely ignore here. (Similar hiccups happen all the time.) |
Twine is broken. Working on fix at pypa/twine#1126. |
And I'm avoiding the breakage at #5196. |
Description
Implements support for typing.Literal
Example declaration.
Allows more narrow return types of python objects.
Suggested changelog entry:
Adds support for `typing.Literal`.