Skip to content

Introspection: implement output type #5208

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Tpt
Copy link
Contributor

@Tpt Tpt commented Jun 23, 2025

  • Adds a new 'returns' field in the introspection data that contains the returned type annotation
  • Generate it using a new IntoPyObject::OUTPUT_TYPE associated constant (similar to INPUT_TYPE)
  • Add the internal PyReturnType trait to allow getting easily T::RETURN_TYPE when the function returns Result<T, E>
  • Take care of the special case of () converted to None and not ()
  • Adding OUTPUT_TYPE to the IntoPyObject will be a follow-up (to avoid a huge PR)

@Tpt Tpt force-pushed the tpt/return-type branch 2 times, most recently from 7282dd7 to 84559e7 Compare June 23, 2025 13:26
- Adds a new 'returns' field in the introspection data that contains the returned type annotation
- Generate it using a new IntoPyObject::OUTPUT_TYPE associated constant (similar to INPUT_TYPE)
- Add the internal PyReturnType trait to allow getting easily T::RETURN_TYPE when the function returns Result<T, E>
- Take care of the special case of `()` converted to `None` and not `()`
- Adding `OUTPUT_TYPE` to the `IntoPyObject` will be a follow-up (to avoid a huge PR)
@Tpt Tpt force-pushed the tpt/return-type branch from 84559e7 to d09f8e2 Compare June 23, 2025 13:50
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.

1 participant