STINNER Victor <victor.stin...@gmail.com> added the comment: About the API itself, I'm not sure that PyMem_AlignedAlloc(alignment, size) is flexible enough. If we want to get *data* aligned in a Python object, we would have to pass an offset to the data, since Python objects have headers of variable size (depending on the type).
Windows has such API: void * _aligned_offset_malloc( size_t size, size_t alignment, size_t offset ); This function is based on malloc, so likely adds padding bytes for you depending on size, alignment and offset. https://msdn.microsoft.com/fr-fr/library/ec852tkw.aspx See bpo-27987: "obmalloc's 8-byte alignment causes undefined behavior". ---------- _______________________________________ 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