PoC,WIP: Proof of concept for extending buffer protocol string #50
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.
This is a proof of concept, that allows roundtripping code such as:
As well as a PoC for basic Cython exposure as a typed memory-view (see below).
I opted to simply store the
descr
pointer directly. This seems just as well because the descr owns the side-car buffer. One could still export it to non-Python (somewhat) since accessing that side-car buffer doesn't need Python API in the end (just struct layout information).For the times I opted to store two hex ints. From Python that is awkward, but our time enum is public anyway. (But we could also store
ns
, etc. strings.)Note: This branch shows a minimal PoC extension to access NumPy string arrays via Cython (these are particularly difficulty, because one needs the allocator to access elements).
Because of this, it requires using this branch of Cython da-woods/cython#5