Commits

Matt Chaput  committed 542e638

Added byte(n) function to generate a length-1 bytes object.

  • Participants
  • Parent commits 0ac0d3b

Comments (0)

Files changed (1)

File src/whoosh/compat.py

     bytes_type = str
     unichr = unichr
     from urllib import urlretrieve
+    
+    def byte(num):
+        return chr(num)
 
     def u(s):
         return unicode(s, "unicode_escape")
     bytes_type = bytes
     unichr = chr
     from urllib.request import urlretrieve
+    
+    def byte(num):
+        return bytes((num,))
 
     def u(s):
         if isinstance(s, bytes):