[Python-bugs-list] struct module inconsistency (PR#362)
lorenzo@sancho.ccd.uniroma2.it
lorenzo@sancho.ccd.uniroma2.it
Sat, 17 Jun 2000 10:47:51 -0400 (EDT)
Full_Name: Lorenzo M. Catucci
Version: 1.5.2, 1.6a2
OS: Linux-i386
Submission from: ip022.pool-300.cyb.it (195.191.58.86)
I don't know if this is a module or a documentation, but in struct module's
documentation, i read "Alternatively, the first character of the format
string can be used to indicate the byte order, size and alignment of
the packed data, according to the following table:[...]".
Now, I'm trying to wrap some video IOCTLS for linux/python use, and I have
a struct like:
audio_fmt='iHHHI16sHHH'; the compiler (at least for the i386 arch) puts in
pad-bytes after those ushort; therefore, when I saw I and the kernel were
using different struct sizes, I tried putting the magic `@' sign, but no
padding came in, and I still had a py struct different than the C one.
The stopgap solution has been putting in 0i alignment points like in
audio_fmt='ihhh0ii16shhh0i', but it sounds like such stuff should be done
by the @, especially since the module knows the system it was compiled on,
while I don't know if a pure python module I manually aligned for i386
would work on a PowerPC or an Alpha system!
So stop and thank you all.
Yours,
lorenzo m catucci