kai zhu <[email protected]> added the comment:
traced culprit to sre_parse.py <line 711> (where literal is always str):
...
def parse_template(source, pattern):
# parse 're' replacement string into list of literals and
# group references
s = Tokenizer(source)
sget = s.get
p = []
a = p.append
def literal(literal, p=p, pappend=a):
if p and p[-1][0] is LITERAL:
p[-1] = LITERAL, p[-1][1] + literal
else:
pappend((LITERAL, literal))
...
a possible hack-around is <line 717>:
...
a = p.append
def literal(literal, p=p, pappend=a):
if isinstance(source, (bytes, bytearray)): # hack
literal = literal.encode() # hack str->bytes
if p and p[-1][0] is LITERAL:
...
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6509>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com