Skip to content

Commit

Permalink
Revert "Use newer API to prevent deprecation warning"
Browse files Browse the repository at this point in the history
This reverts commit 84fc518.
  • Loading branch information
ines committed Oct 28, 2019
1 parent c14c823 commit 98c0b4f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion srsly/tests/msgpack/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def test_unpack_buffer():
from array import array
buf = array('b')
buf.frombytes(packb((b'foo', b'bar')))
buf.fromstring(packb((b'foo', b'bar')))
obj = unpackb(buf, use_list=1)
assert [b'foo', b'bar'] == obj

Expand Down
4 changes: 2 additions & 2 deletions srsly/tests/msgpack/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ def default(obj):
print('default called', obj)
if isinstance(obj, array.array):
typecode = 123 # application specific typecode
data = obj.tobytes()
data = obj.tostring()
return ExtType(typecode, data)
raise TypeError("Unknown type object %r" % (obj,))

def ext_hook(code, data):
print('ext_hook called', code, data)
assert code == 123
obj = array.array('d')
obj.frombytes(data)
obj.fromstring(data)
return obj

obj = [42, b'hello', array.array('d', [1.1, 2.2, 3.3])]
Expand Down
2 changes: 1 addition & 1 deletion srsly/tests/msgpack/test_memoryview.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def make_array(f, data):
return a

def get_data(a):
return a.tobytes()
return a.tostring()
else:
make_memoryview = memoryview

Expand Down

0 comments on commit 98c0b4f

Please sign in to comment.