-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(types): add typing and collections.abc module prefix #5663
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
fc436dd
Fix Python 3.8 type hints and add module prefix
gentlegiantJGC 7f59a8b
style: pre-commit fixes
pre-commit-ci[bot] cf1610c
Add module prefix to Union
gentlegiantJGC 78b2f91
Rename macros
gentlegiantJGC ac9a3fd
Improve comment
gentlegiantJGC aaff285
Comment out 3.8 type hint macros
gentlegiantJGC f27cc9e
Add Iterable module prefix
gentlegiantJGC 1d143be
Add module prefix to Iterator
gentlegiantJGC 6806f11
Add module prefix to Callable
gentlegiantJGC 4faee40
Re-add accidentally deleted brackets
gentlegiantJGC 64345df
Add module prefix to Optional
gentlegiantJGC 22f9ceb
Add module prefix to Final
gentlegiantJGC 345f974
Add module prefix to ClassVar
gentlegiantJGC 7915d6e
Add module prefix to TypeGuard
gentlegiantJGC 299a65a
Add module prefix to TypeIs
gentlegiantJGC 88d408b
Add module prefix to NoReturn
gentlegiantJGC f125949
Add module prefix to Never
gentlegiantJGC 6a013af
Add module prefix to Literal
gentlegiantJGC 99700bb
Add module prefix to Callable
gentlegiantJGC 9b93079
Add module prefix to Sequence
gentlegiantJGC 21663a3
Add module prefix to Iterator
gentlegiantJGC edc52b5
Merge branch 'master' into fix-type-hints-3-9
gentlegiantJGC 5751384
style: pre-commit fixes
pre-commit-ci[bot] edb4ba3
Remove type hint macros
gentlegiantJGC e684a4d
style: pre-commit fixes
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,6 +239,27 @@ | |
# define PYBIND11_SUBINTERPRETER_SUPPORT | ||
#endif | ||
|
||
// 3.9 Compatibility | ||
#if 0x03090000 <= PY_VERSION_HEX | ||
# define PYBIND11_ITERABLE_TYPE_HINT "collections.abc.Iterable" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion to make these
so they line up nicely and are easier to pin-point. |
||
# define PYBIND11_ITERATOR_TYPE_HINT "collections.abc.Iterator" | ||
# define PYBIND11_CALLABLE_TYPE_HINT "collections.abc.Callable" | ||
# define PYBIND11_SEQUENCE_TYPE_HINT "collections.abc.Sequence" | ||
# define PYBIND11_TUPLE_TYPE_HINT "tuple" | ||
# define PYBIND11_DICT_TYPE_HINT "dict" | ||
# define PYBIND11_LIST_TYPE_HINT "list" | ||
# define PYBIND11_SET_TYPE_HINT "set" | ||
#else | ||
# define PYBIND11_ITERABLE_TYPE_HINT "typing.Iterable" | ||
# define PYBIND11_ITERATOR_TYPE_HINT "typing.Iterator" | ||
# define PYBIND11_CALLABLE_TYPE_HINT "typing.Callable" | ||
# define PYBIND11_SEQUENCE_TYPE_HINT "typing.Sequence" | ||
# define PYBIND11_TUPLE_TYPE_HINT "typing.Tuple" | ||
# define PYBIND11_DICT_TYPE_HINT "typing.Dict" | ||
# define PYBIND11_LIST_TYPE_HINT "typing.List" | ||
# define PYBIND11_SET_TYPE_HINT "typing.Set" | ||
#endif | ||
|
||
// #define PYBIND11_STR_LEGACY_PERMISSIVE | ||
// If DEFINED, pybind11::str can hold PyUnicodeObject or PyBytesObject | ||
// (probably surprising and never documented, but this was the | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
?
(The
+
is the most important aspect of my suggestion.)