mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fix unicode handling issue of utils.str.format on Python 2.
This commit is contained in:
parent
7057112d2d
commit
8be1671867
@ -448,6 +448,13 @@ def format(s, *args, **kwargs):
|
||||
# to add the character to the _formatRe regexp or it will be ignored
|
||||
# (and hard to debug if you don't know the trick).
|
||||
# Of course, you should also document it in the docstring above.
|
||||
if sys.version_info.major < 3:
|
||||
def pred(s):
|
||||
if isinstance(s, unicode):
|
||||
return s.encode('utf8')
|
||||
else:
|
||||
return s
|
||||
args = map(pred, args)
|
||||
args = list(args)
|
||||
args.reverse() # For more efficient popping.
|
||||
def sub(match):
|
||||
|
Loading…
Reference in New Issue
Block a user