On Tue, 04 Oct 2011 21:33:34 +0200 "Martin v. Löwis" <mar...@v.loewis.de> wrote: > Am 04.10.11 21:06, schrieb Amaury Forgeot d'Arc: > > 2011/10/4 "Martin v. Löwis"<mar...@v.loewis.de>: > >> > >>> - _PyBytes_Resize() is missing; I moved it under a Py_LIMITED_API > >>> section. > >> > >> ??? Are you proposing to add _PyBytes_Resize to the Py_LIMITED_API > >> 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 _PyBytes_Resize 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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com