Skip to content

Introspection: emit doc comments#5782

Merged
davidhewitt merged 2 commits intoPyO3:mainfrom
Tpt:tpt/stub-doc
Feb 14, 2026
Merged

Introspection: emit doc comments#5782
davidhewitt merged 2 commits intoPyO3:mainfrom
Tpt:tpt/stub-doc

Conversation

@Tpt
Copy link
Contributor

@Tpt Tpt commented Feb 5, 2026

Notable changes:

  • get_doc() now returns an intermediate structure. The to_cstr_stream function returns the expected cstr
  • get_doc() now returns an option when there is no doc
  • PyMemberDef.doc is now set to NULL if there is no doc instead of the empty string (NULL is allowed by cpython doc)
  • same for PyGetSetDef.doc

Still missing is the support of enum variant and constants doc comments

Notable changes:
- get_doc() now returns an intermediate structure. The `to_cstr_stream` returns the expected cstr
- get_doc() returns now an option when there is no doc
- erroring on nul byte is delegated to `cstr!`
- PyMemberDef.doc is now set to NULL if there is no doc instead of the empty string (NULL is allowed by cpython doc)
- same for PyGetSetDef.doc
@Tpt Tpt marked this pull request as ready for review February 5, 2026 12:24
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have one initial thought which might influence the rest of the review.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a great improvement!

Sorry to take some time to review, kept coming back to this in multiple sessions.

@davidhewitt davidhewitt added this pull request to the merge queue Feb 14, 2026
@Tpt
Copy link
Contributor Author

Tpt commented Feb 14, 2026

@davidhewitt This is a very big MR, thank you fog going through it

Merged via the queue into PyO3:main with commit 4d4e41c Feb 14, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants