Skip to content

Commit

Permalink
Fixed exception in encode_cstring with Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnoor authored and Parkayun committed Feb 14, 2017
1 parent b576657 commit 5f7f534
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bson/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def encode_string(value):
def encode_cstring(value):
if not isinstance(value, bytes):
value = value.encode("utf-8")
if "\x00" in value:
if b"\x00" in value:
raise ValueError("Element names may not include NUL bytes.")
# A NUL byte is used to delimit our string, accepting one would cause
# our string to terminate early.
Expand Down

0 comments on commit 5f7f534

Please sign in to comment.