[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2020-05-23 Thread Cheryl Sabella
Change by Cheryl Sabella : -- versions: +Python 3.10, Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-07-15 Thread Eric Wieser
Eric Wieser added the comment: Pinging again, now that the patch has undergone a revision with some cleanup thanks to @skrah -- ___ Python tracker ___

[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Eric Wieser
Eric Wieser added the comment: > Revising the code example to use an empty array I think you mean >>> import array >>> memoryview(array.array('H', [])).itemsize 2 Your example is an array containing 0, not an empty array - but the conclusion is the same. > It is technically un-necessary

[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Stefan Krah
Stefan Krah added the comment: I agree that it is a ctypes issue, itemsize should be equal to struct.calcsize(fmt), which is never 0 for normal PEP-3118 types like the one in the example. [Pedantically, I think that the grammar would allow for an empty record "T{}" that would have

[issue32782] memoryview & ctypes: incorrect itemsize for empty array

2019-04-14 Thread Terry J. Reedy
Terry J. Reedy added the comment: https://docs.python.org/3/library/stdtypes.html#typememoryview says "itemsize The size in bytes of each element of the memoryview" Revising the code example to use an empty array: >>> import array, struct >>> m = memoryview(array.array('H', [0]) >>> m.itemsize