[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Georg Brandl
Georg Brandl added the comment: Agreed. -- resolution: -> not a bug status: open -> closed ___ Python tracker ___

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I can't get two arrays one int, one byte with the same backing memory where > changes to one effect the other For this case you can use an array or bytearray + memoryview. I think this issue can be closed. -- nosy: +serhiy.storchaka

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Georg Brandl
Georg Brandl added the comment: Indeed, I don't think the `array` module is much used anymore. If you're looking to serialize or deserialize fixed-size formats, you'll probably want the `struct` module. It has both native and fixed-size modes. For anything else involving arrays (mostly, but

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Jonathan Booth
Jonathan Booth added the comment: Ugly -- if I know I'm dealing with 4-byte data, I can't just specify 'I' or 'L' because it'll be wrong on some platform? Maybe the bug is really the module's design. Seems I need to look elsewhere for other reasons (array seems to want to copy memory, rather

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread random832
random832 added the comment: It says *minimum* size for a reason. The *actual* sizes of the types used in array are platform-dependent. 2 is the smallest that an int can be (it is probably not that size on any currently supported platforms, but would have been in DOS), and 4 is the smallest

[issue26821] array module "minimum size in bytes" table is wrong for int/long

2016-04-21 Thread Jonathan Booth
New submission from Jonathan Booth: https://docs.python.org/3.5/library/array.html describes the 'I' and 'i' typecodes as being minimum-size in bytes of 2. The interpreter disagrees: >>> import array >>> a = array.array('i') >>> a.itemsize 4 There is also a bug with the 'L' and 'l' long