Fix 're' to work on bytes. It could do with a few more tests, though.

This commit is contained in:
Thomas Wouters 2008-03-18 20:19:54 +00:00
parent e8c3d266c8
commit 40a088dc27
3 changed files with 22 additions and 34 deletions

View file

@ -192,8 +192,8 @@ class Tokenizer:
char = self.string[self.index:self.index+1]
# Special case for the str8, since indexing returns a integer
# XXX This is only needed for test_bug_926075 in test_re.py
if isinstance(self.string, bytes):
char = chr(char)
if char and isinstance(char, bytes):
char = chr(char[0])
if char == "\\":
try:
c = self.string[self.index + 1]