Skip to content

Commit

Permalink
Fix _wordbreak() to always return a str.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwelling committed Jul 9, 2020
1 parent bac5775 commit 540e0d1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dns/rdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
_chunksize = 32


def _wordbreak(line, chunksize=_chunksize):
"""Break a string into chunks of chunksize characters separated by a space.
def _wordbreak(data, chunksize=_chunksize):
"""Break a binary string into chunks of chunksize characters separated by
a space.
"""

if not chunksize:
return line
return b' '.join([line[i:i + chunksize]
return data.decode()
return b' '.join([data[i:i + chunksize]
for i
in range(0, len(line), chunksize)]).decode()
in range(0, len(data), chunksize)]).decode()


def _hexify(data, chunksize=_chunksize):
Expand Down

0 comments on commit 540e0d1

Please sign in to comment.