-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix: add class doc string to py::native_enum #5617
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2d06ad7
add class doc string to native_enum
dyollb a952009
adapt doc argument name
dyollb d998809
fix test, make class enum doc None by default
dyollb 4b0e68c
fix other python versions?
dyollb eda2be7
make clang-tidy happy
dyollb f53f182
rename 'enum_doc' to 'class_doc'
dyollb a8bdaeb
update documentation
dyollb 0346498
[skip ci] Polish changed documentation (mostly done by ChatGPT).
rwgk 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 |
---|---|---|
|
@@ -24,9 +24,10 @@ class native_enum : public detail::native_enum_data { | |
|
||
native_enum(const object &parent_scope, | ||
const char *name, | ||
const char *native_type_name = "enum.Enum") | ||
const char *native_type_name, | ||
const char *doc = "") | ||
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. Drive-by comment: Could you please use the same (longer) name consistently here and in native_enum_data.h? 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. done |
||
: detail::native_enum_data( | ||
parent_scope, name, native_type_name, std::type_index(typeid(EnumType))) { | ||
parent_scope, name, native_type_name, doc, std::type_index(typeid(EnumType))) { | ||
if (detail::get_local_type_info(typeid(EnumType)) != nullptr | ||
|| detail::get_global_type_info(typeid(EnumType)) != nullptr) { | ||
pybind11_fail( | ||
|
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.
You're using "class doc" in the PR title and the added test: I think it's a much better name than
enum_doc
here, because then it is crystal clear that it does not apply to the enum members. Could you please useclass_doc
here (and in native_enum.h), too?