Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Currently memoryview.cast requires C-contiguous data when going from N-D to 1-D. As a result F-contiguous data is not supported. Please see example below:
>>>mv.c_contiguousFalse>>>mv.f_contiguousTrue>>>mv.cast("B") Traceback (mostrecentcalllast): File"<stdin>", line1, in<module>TypeError: memoryview: castsarerestrictedtoC-contiguousviewsHowever as F-contiguous data is still contiguous and can be viewed in 1-D, it seems possible to support this type of data as well. PickleBuffer's raw method does appear to support both C & F contiguous data. Building off the example above:
>>>frompickleimportPickleBuffer>>>pb=PickleBuffer(mv) >>>pb.raw() <memoryat0x1105cec70>This would be useful when interacting with other libraries that work with this kind of data. That said, don't know if there is other context behind the C-contiguous constraint that I may be missing here.
Linked PRs
Metadata
Metadata
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement