Stefan Krah <ste...@bytereef.org> added the comment: Yes, I think it is partly convenience. I want to set ...
ndt_mallocfunc = PyMem_Malloc; ndt_alignedallocfunc = PyMem_AlignedAlloc; ndt_callocfunc = PyMem_Calloc; ndt_reallocfunc = PyMem_Realloc; ndt_freefunc = PyMem_Free; ... so I can always just call ndt_free(), because there's only one memory allocator. But the other part is that datashape allows to specify alignment regardless of the size of the type. Example: >>> from ndtypes import * >>> from xnd import * >>> t = ndt("{a: int64, b: uint64, align=16}") >>> xnd(t, {'a': 111, 'b': 222}) <xnd.xnd object at 0x7f82750c2a30> The xnd object essentially wraps a typed data pointer. In the above case, the 'align' keyword has the same purpose as gcc's __attribute__((aligned(16))). There are several other cases in datashape where alignment can specified explicitly. For the convenience case it would already help if PyMem_AlignedAlloc() did *not* use the fast allocator, but just delegated to _aligned_malloc() (MSVC) or aligned_alloc() (C11), ... ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue18835> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com