diff options
author | Thomas Wouters <thomas@python.org> | 2008-03-18 20:19:54 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2008-03-18 20:19:54 (GMT) |
commit | 40a088dc27865eb1236d6c728d2880ecd0022a65 (patch) | |
tree | 9489856463cd6b00e2f40ec200a2d640704d8b50 /Lib/sre_parse.py | |
parent | e8c3d266c8cea759a0eb1c17b9c5f989f87bb135 (diff) | |
download | cpython-40a088dc27865eb1236d6c728d2880ecd0022a65.zip cpython-40a088dc27865eb1236d6c728d2880ecd0022a65.tar.gz cpython-40a088dc27865eb1236d6c728d2880ecd0022a65.tar.bz2 |
Fix 're' to work on bytes. It could do with a few more tests, though.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index a04c343..6e70024 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -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] |