Message289193
There appears to be a bug related to sizing/packing of ctypes Structures on Linux. I'm not quite sure how, but this structure:
class MyStructure(Structure):
_pack_ = 1
_fields_ = [
("P", c_uint16), # 2 Bytes
("L", c_uint16, 9),
("Pro", c_uint16, 1),
("G", c_uint16, 1),
("IB", c_uint16, 1),
("IR", c_uint16, 1),
("R", c_uint16, 3), # 4 Bytes
("T", c_uint32, 10),
("C", c_uint32, 20),
("R2", c_uint32, 2) # 8 Bytes
]
Gives back a sizeof of 8 on Windows and 10 on Linux. The inconsistency makes it difficult to have code work cross-platform.
Running the given test.py file will print out the size of the structure on your platform.
Tested with Python 2.7.6 and Python 3.4.3 (builtin to Ubuntu 14.04), Python 2.7.13, (built from source) both on Ubuntu 14.04. On Linux all Python builds were 32 bit.
On Windows I tried with 2.7.7 (both 32 and 64 bit).
I believe on both platforms it should return a sizeof 8. |
|
Date |
User |
Action |
Args |
2017-03-08 00:36:40 | Charles Machalow | set | recipients:
+ Charles Machalow, amaury.forgeotdarc, belopolsky, meador.inge |
2017-03-08 00:36:40 | Charles Machalow | set | messageid: <1488933400.56.0.160685455632.issue29753@psf.upfronthosting.co.za> |
2017-03-08 00:36:40 | Charles Machalow | link | issue29753 messages |
2017-03-08 00:36:40 | Charles Machalow | create | |
|