diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 14:48:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 14:48:02 (GMT) |
commit | ee4c0b9dcfb550094cca086a032d44393b5c3642 (patch) | |
tree | c04129c6917ab6ea583c417066b03afb81828552 /Lib/test/test_buffer.py | |
parent | 000391b7de634635b493b680f14b907d767d8583 (diff) | |
parent | 74a49ac3f5ac3c7a09c691db4888c981a0cb3232 (diff) | |
download | cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.zip cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.tar.gz cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.tar.bz2 |
Issue #23681: Fixed Python 2 to 3 poring bugs.
Indexing bytes retiurns an integer, not bytes.
Diffstat (limited to 'Lib/test/test_buffer.py')
-rw-r--r-- | Lib/test/test_buffer.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_buffer.py b/Lib/test/test_buffer.py index 0d672dd..6803156 100644 --- a/Lib/test/test_buffer.py +++ b/Lib/test/test_buffer.py @@ -150,15 +150,15 @@ def randrange_fmt(mode, char, obj): format character.""" x = randrange(*fmtdict[mode][char]) if char == 'c': - x = bytes(chr(x), 'latin1') + x = bytes([x]) + if obj == 'numpy' and x == b'\x00': + # http://projects.scipy.org/numpy/ticket/1925 + x = b'\x01' if char == '?': x = bool(x) if char == 'f' or char == 'd': x = struct.pack(char, x) x = struct.unpack(char, x)[0] - if obj == 'numpy' and x == b'\x00': - # http://projects.scipy.org/numpy/ticket/1925 - x = b'\x01' return x def gen_item(fmt, obj): |