[Python-Dev] Using PEP384 Stable ABI for the lzma extension module (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Tue Oct 4 21:45:49 CEST 2011


On Tue, 04 Oct 2011 21:33:34 +0200 "Martin v. Löwis" <martin at v.loewis.de> wrote:

Am 04.10.11 21:06, schrieb Amaury Forgeot d'Arc: > 2011/10/4 "Martin v. Löwis"<martin at v.loewis.de>: >> >>> - PyBytesResize() is missing; I moved it under a PyLIMITEDAPI >>> section. >> >> ??? Are you proposing to add PyBytesResize to the PyLIMITEDAPI >> set of functions? It's not even an API function in the first place >> (it starts with an underscore), so how can it be a limited API function? > > It's not a proposal of any kind; it's just the workaround I used to compile > and test. > OTOH, it seems that many modules already use this function. Is there > another method that does not need to copy data?

Not sure what you are using it for. If you need to extend the buffer in case it is too small, there is absolutely no way this could work without copies in the general case because of how computers use address space. Even PyBytesResize will copy the data.

That's not a given. Depending on the memory allocator, a copy can be avoided. That's why the "str += str" hack is much more efficient under Linux than Windows, AFAIK.

Regards

Antoine.



More information about the Python-Dev mailing list