mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #23681: Fixed Python 2 to 3 poring bugs.
Indexing bytes retiurns an integer, not bytes.
This commit is contained in:
parent
d83b7c2df4
commit
74a49ac3f5
5 changed files with 12 additions and 14 deletions
|
@ -149,15 +149,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue