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

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


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

Some more strange results:

Python 2.6.1+ (release26-maint:68613, Jan 15 2009, 15:19:54) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from struct import pack
>>> from decimal import Decimal
>>> pack('l', Decimal('3.14'))
'\x03\x00\x00\x00'
>>> pack('L', Decimal('3.14'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'Decimal' and 'long'

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


More information about the Python-bugs-list mailing list