Skip to content

How to wrap a PyAny in a typeful API? #3844

Answered by davidhewitt
kythyria asked this question in Questions
Discussion options

You must be logged in to vote

Sorry for the long delay in response here. You may have come across the pyobject_native_type family of macros in PyO3's codebase which are used in PyO3 and rust-numpy to set up typeful APIs.

These macros haven't been added to the public API and documented yet, we've been working for a long time to figure out the Bound API which has solved several longstanding pain points with PyO3. I would be open to us figuring out how to make these macros part of the public API as we get the older "GIL Refs" API removed. But maybe these macros are mostly unnecessary once the GIL Refs API is gone.

In direct answer to your questions:

  1. You should implement the PyTypeCheck trait for your Mesh type. This all…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kythyria
Comment options

@davidhewitt
Comment options

@kythyria
Comment options

@davidhewitt
Comment options

Answer selected by kythyria
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants