Make `byte_ord` gentler

This commit is contained in:
Jeff Forcier 2014-03-07 13:16:47 -08:00
parent c646e72832
commit 85e9405f8a
1 changed files with 3 additions and 1 deletions

View File

@ -113,7 +113,9 @@ else:
return s return s
def byte_ord(c): def byte_ord(c):
assert isinstance(c, int) # In case we're handed a string instead of an int.
if not isinstance(c, int):
c = ord(c)
return c return c
def byte_chr(c): def byte_chr(c):