diff options
author | Damien George <damien.p.george@gmail.com> | 2017-10-04 17:59:22 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-10-04 17:59:22 +1100 |
commit | dfa563c71fead671931e91b786cd649eed517f92 (patch) | |
tree | 8cf821b265a73797ceef9c2e6979b9a63712bd04 /tests/basics/bytes.py | |
parent | a3dc1b1957d2c96d7c60c2c629c95077b03488a1 (diff) |
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.
Diffstat (limited to 'tests/basics/bytes.py')
-rw-r--r-- | tests/basics/bytes.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/basics/bytes.py b/tests/basics/bytes.py index d3da15c8e..1d97e6b16 100644 --- a/tests/basics/bytes.py +++ b/tests/basics/bytes.py @@ -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)) |