[issue1741130] struct.pack("I", "foo"); struct.pack("L", "foo") should fail

Mark Dickinson report at bugs.python.org
Sun Apr 19 23:10:47 CEST 2009


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

It looks as though this was sort-of fixed sometime between 2.6.1 and 
2.6.2.  In 2.6.2, I get the following (and results from trunk and 3.0.1 
are similar):

Python 2.6.2+ (release26-maint:71755, Apr 19 2009, 22:06:02) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.pack('L', 'not an integer')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'str' and 'long'

That error message suggests that there's something nasty happening 
somewhere, though.  It looks as though we're getting the right type of 
exception, but for the wrong reasons.

----------

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


More information about the Python-bugs-list mailing list