Stefan Krah added the comment: -1 on complicating the code further. It would be possible to pass an existing memoryview to mbuf_add_view(). That would save the line
mv = memory_alloc(). But: a) You need to check that ndim is correct (shape, strides and suboffsets are allocated via the struct hack). b) You need to check for existing exports of the memoryview. c) ... probably other things that would surface on closer examination. ---------- nosy: +skrah _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19577> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com