This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A helper / hack to allow us to cast a mmap.mmap or other buffer to a Cython pointer of the correct type.

Cython is capable of casting a lot of things to a C pointer of the correct type, especially with the aid of memoryview. However, in Python 2, memoryview lacks the memoryview.cast method (so Cython won’t let us change the dimensions of the array). Further, both Python 2 and 3 require the memory map to be writable (making the pointer type const does not seem to help here either).

This class takes a (possibly read-only) memmap object, and produces a Python object with a __getbuffer__ method that returns The Right Thing. It pretends that the underlying buffer is writable to make Cython happy. If you give it a read-only buffer, and try to write to the result, then you will have a bad time.

When a Python object is cast by Cython to a pointer, it holds a reference to the underlying Python object in order to prevent the memory to which it refers being garbage collected. The MagicMemoryView in turn keeps a reference to the underlying data, so everything should behave as expected.


from magicmemoryview import MagicMemoryView

cdef double data[:, :, :]

data = MagicMemoryView(source_buffer, (24, 12, 25), "d")
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
magicmemoryview-0.1.5.tar.gz (23.5 kB) Copy SHA256 Checksum SHA256 Source Aug 10, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting