-
Notifications
You must be signed in to change notification settings - Fork 104
Description
It appears that the module-level functions snappy.compress and snappy.uncompress have bitrotted and fallen behind the new framed version produced/consumed by the command-line interface.
Is the framed version adopted enough that those should be made consistent? Regardless, having this inconsistency seems like the wrong thing to do.
$ echo 'hello' | python -m snappy -c > hello.sz
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import snappy
snappy.uncompress(open('hello.sz').read())
Traceback (most recent call last):
File "", line 1, in
snappy.UncompressError: Error while decompressing: invalid inputopen('hello.sz').read()
'\xff\x06\x00\x00sNaPpY\x01\n\x00\x00SU\xffShello\n'
d = open('hello.sz').read()
snappy.uncompress(d)
Traceback (most recent call last):
File "", line 1, in
snappy.UncompressError: Error while decompressing: invalid inputsnappy.compress('hello\n')
'\x06\x14hello\n'from cStringIO import StringIO
fh = StringIO()
snappy.stream_decompress(StringIO(d), fh)
fh.getvalue()
'hello\n'