[Python-Dev] PEP3118, python 2.6

Lisandro Dalcin dalcinl at gmail.com
Thu Jun 5 19:28:36 CEST 2008


On 6/5/08, Thomas Heller <theller at ctypes.org> wrote:
Thomas, Iff this helps, you have attached the backport but as an
extension module.  Sorry, I do not have time for the full backport.
But at least, I've found that the Py3K implementation works

You will need to build it with 'python2.6 setup.py build' and copy
'memvwr.so' somewhere in your $PYTHONPATH, then in you 'site.py' or
whatever, you can do 'import memvwr; del memvwr' . This will
automaticall add the module to the __builtin__ module.

Some notes:

* I had to add Py_TPFLAGS_HAVE_NEWBUFFER to the type object structure.
Should'nt this be already included in Py_TPFLAGS_DEFAULT ?

* I have to monkey-copy two auxiliary functions 'abstrac.c' for Py3k,
as ther are employed in memoryobject.c Travis, I believe you should
have to review this. I'm not sure iff that is the right approach,
regarding symbol visibility in shared libs in different OS's,
compilers, etc.. But perhaps all is OK. Just a warning about possible
problems :-).

* I've not implemented the former buffer interface, I just put NULL's
for the slots. Not sure if implementing the former interface is relly
needed.

* I've used PyString_XXX API calls.  Not sure what will be the final
status of the C API cleanup for Py2.6. Perhaps this should be replaced
with PyBytes_XXXX

> Thomas Heller schrieb:
>
> > I'm currently trying to port the pep3118 ctypes changes which are already in
>  > the py3k branch to the trunk.
>  >
>  > In py3k the tests for this stuff (in Lib/ctypes/test/test_pep3118.py) use
>  > the memoryview object which exposes attributes like .format, .shape, .strides
>  > and so on for objects implementing the new buffer interface.
>  >
>  > In Python 2.6 memoryview does not exist so the question is how to write a test
>  > that checks for the correct attributes.  My idea is to implement the
>  > __array_interface__ property for ctypes instances, as described in this document
>  > http://numpy.scipy.org/array_interface.shtml.
>
>
> In private email Travis told me that he has no time to backport the memoryview
>  object to Python 2.6.  Maybe there is someone who could do this (Myself I have
>  no time either for this)?
>
>
>  Thomas
>
>  _______________________________________________
>  Python-Dev mailing list
>  Python-Dev at python.org
>  http://mail.python.org/mailman/listinfo/python-dev
>  Unsubscribe: http://mail.python.org/mailman/options/python-dev/dalcinl%40gmail.com
>


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memoryview-py2.6.tar.gz
Type: application/x-gzip
Size: 6427 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080605/b1c7df6e/attachment.bin>


More information about the Python-Dev mailing list