STINNER Victor victor.stin...@haypocalc.com added the comment:
Sorry, but I don't see this issue as a bug because it's related to
memory alignment as explained in the documentation.
I choose to close this issue. If you think that the documentation
should be improved, please suggest an
Georg Brandl ge...@python.org added the comment:
The docs have this sentence:
By default, C numbers are represented in the machine's native format and
byte
order, and properly aligned by skipping pad bytes if necessary
(according to the
rules used by the C compiler).
What would you suggest
STINNER Victor victor.stin...@haypocalc.com added the comment:
The default endiand and alignment is native. Using , , = or !
endian, the alignement is standard.
Python 3.1a0 (py3k:69105M, Feb 3 2009, 15:04:35)
struct.calcsize('cd')
12
struct.calcsize('=cd')
9
struct.calcsize('cd')
9
Changes by Antoine Pitrou pit...@free.fr:
--
assignee: - georg.brandl
components: +Documentation -Extension Modules
nosy: +georg.brandl
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5145
bob gailer bgai...@gmail.com added the comment:
Someone pointed out that one must consider alignment. I had overlooked
that. It makes sense that a d is double-word aligned.
Perhaps the documentation should mention alignment.
___
Python tracker
New submission from bob gailer bgai...@gmail.com:
struct.calcsize('cd') returns 16 instead of 9
struct.calcsize('dc') returns 9 as expected
--
components: Extension Modules
messages: 81085
nosy: bgailer
severity: normal
status: open
title: struct.calcsize('cd') returns 16 instead of 9