[issue1789] assumption about unsigned long byte size in struct module usage

Gregory P. Smith report at bugs.python.org
Thu Jan 24 10:40:19 CET 2008


Gregory P. Smith added the comment:

Anders J. Munch on python-dev correctly says:

You overlooked the words "Standard size and alignment are as follows"
that start the quoted paragraph.  It's a little confusing because
standard size is not the default.  The default is platform-specific
sizes.  Only if you start the format string with >, <, ! or = do you
get standard sizes.

The reference documentation is correct as it stands, and, I suspect,
so is the LP64 implementation.  Doesn't struct.pack('>l',42) produce a
4-byte string on LP64?

The tutorial at
http://docs.python.org/tut/node13.html#SECTION0013300000000000000000%3E
has a bug though: the format string should use '<'.

I believe zipfile.py correctly uses '<' throughout.

----------
keywords: +easy -patch
priority: urgent -> normal
severity: major -> normal
versions:  -Python 2.4

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1789>
__________________________________


More information about the Python-bugs-list mailing list