py/objstr: Make empty bytes object have a null-terminating byte.
Because a lot of string processing functions assume there is a null terminating byte, so they can work in an efficient way. Fixes issue #3334.
This commit is contained in:
@@ -8,6 +8,9 @@ print(b'\u1234')
|
||||
print(bytes())
|
||||
print(bytes(b'abc'))
|
||||
|
||||
# make sure empty bytes is converted correctly
|
||||
print(str(bytes(), 'utf-8'))
|
||||
|
||||
a = b"123"
|
||||
print(a)
|
||||
print(str(a))
|
||||
|
||||
Reference in New Issue
Block a user