From b87fca27261f79be20ab06a222ed2330d60d9f2c Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sat, 25 Mar 2017 10:11:43 +0000 Subject: MAINT: Remove asbytes where a b prefix would suffice Since we only need to support python 2, we can remove any case where we just pass a single string literal and use the b prefix instead. What we can't do is transform asbytes("tests %d" % num), because %-formatting fails on bytes in python 3.x < 3.5. --- numpy/lib/format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/format.py') diff --git a/numpy/lib/format.py b/numpy/lib/format.py index 633aee675..14dec01d5 100644 --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -161,7 +161,7 @@ if sys.version_info[0] >= 3: else: import cPickle as pickle -MAGIC_PREFIX = asbytes('\x93NUMPY') +MAGIC_PREFIX = b'\x93NUMPY' MAGIC_LEN = len(MAGIC_PREFIX) + 2 BUFFER_SIZE = 2**18 # size of buffer for reading npz files in bytes -- cgit v1.2.1