fix: add class doc string to py::native_enum#5617
Merged
rwgk merged 8 commits intopybind:masterfrom Apr 15, 2025
Merged
Conversation
rwgk
reviewed
Apr 14, 2025
include/pybind11/native_enum.h
Outdated
| const char *name, | ||
| const char *native_type_name = "enum.Enum") | ||
| const char *native_type_name, | ||
| const char *doc = "") |
Collaborator
There was a problem hiding this comment.
Drive-by comment: Could you please use the same (longer) name consistently here and in native_enum_data.h?
Contributor
Author
|
Locally this test in assert m.member_doc.mem1.__doc__ == pure_native.mem.__doc__It seems the class doc string is inherited (together with all public class methods) unless overridden in the value. |
Collaborator
|
I think we need to update the docs too? |
henryiii
approved these changes
Apr 14, 2025
rwgk
reviewed
Apr 15, 2025
| native_enum_data(const object &parent_scope, | ||
| const char *enum_name, | ||
| const char *native_type_name, | ||
| const char *enum_doc, |
Collaborator
There was a problem hiding this comment.
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 use class_doc here (and in native_enum.h), too?
b-pass
pushed a commit
to b-pass/pybind11
that referenced
this pull request
May 9, 2025
* add class doc string to native_enum * adapt doc argument name * fix test, make class enum doc None by default * fix other python versions? * make clang-tidy happy * rename 'enum_doc' to 'class_doc' * update documentation * [skip ci] Polish changed documentation (mostly done by ChatGPT). --------- Co-authored-by: Bryn Lloyd <12702862+dyollb@users.noreply.github.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #5615
Suggested changelog entry:
Add class doc string to ``py::native_enum``