kutsurak / python-bitstring

Automatically exported from code.google.com/p/python-bitstring
0 stars 0 forks source link

pack fails with big BitStream #113

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What's the problem? (If this is a feature request then feel free to delete
all the questions and just say what you want!)

pack raises an exception when called with big BitStream by kwargs.

Python 2.6.6 (r266:84292, May 20 2011, 10:25:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bitstring
>>> bitstring.pack('bits=b', b=bitstring.BitString(bytes='0x00'*128))
[snip]
bitstring.CreationError: Invalid symbol in hex initialiser.

What is the expected output? What do you see instead?

Expected: the same as pack's result by values (not by kwargs)

>>> import bitstring
>>> bitstring.pack('bits', bitstring.BitString(bytes = '\x00'*128))
BitStream('0x0000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000...') # length=1024

Which version of bitstring are you using (bitstring.__version__), which
version of Python (e.g. 2.7, 3.2) and what platform
(Linux, Windows, etc.)

Python 2.6.6
bitstring version: 2.2.0
Mac OS X 10.6.7 64bit

Please provide any additional information below.

I suspect that str call would do harm at
http://code.google.com/p/python-bitstring/source/browse/tags/bitstring-2.2.0/bit
string/bitstream.py#202

Original issue reported on code.google.com by sh...@accense.com on 24 Jun 2011 at 1:30

GoogleCodeExporter commented 9 years ago
Hi, thanks for the report. Strange bug at first sight (and I'm not too 
surprised that no one has reported it before) but I can see the problem and 
will fix it in the next version.

Cheers,

Scott

Original comment by dr.scott...@gmail.com on 24 Jun 2011 at 10:35

GoogleCodeExporter commented 9 years ago
Fixed in r.913. 

Original comment by dr.scott...@gmail.com on 7 Jul 2011 at 11:32