[issue1530559] struct.pack raises TypeError where it used to convert

Mark Dickinson report at bugs.python.org
Thu Jan 15 18:23:10 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Retargeting, now that 2.5 is in security-fix-only mode.

Bob, can you clarify what *should* be happening in 2.6, 2.7, 3.0 and 3.1 
for things like:

struct.pack('L', 2009.1)
struct.pack('L', Decimal('3.14')) 

?

It also seems that 'L' and 'Q behave differently.  For example, with 2.7:

>>> struct.pack('L', 3.1)
sys:1: DeprecationWarning: integer argument expected, got float
'\x03\x00\x00\x00'
>>> struct.pack('Q', 3.1)
'\x03\x00\x00\x00\x00\x00\x00\x00'

----------
nosy: +marketdickinson
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1 -Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1530559>
_______________________________________


More information about the Python-bugs-list mailing list