mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Reverting my previous commit.
Something went horribly wrong when I was doing `hg rebase`.
This commit is contained in:
parent
802d45b660
commit
7aa5341164
19 changed files with 787 additions and 1101 deletions
|
@ -112,7 +112,10 @@ class Template(metaclass=_TemplateMetaclass):
|
|||
# Check the most common path first.
|
||||
named = mo.group('named') or mo.group('braced')
|
||||
if named is not None:
|
||||
return str(mapping[named])
|
||||
val = mapping[named]
|
||||
# We use this idiom instead of str() because the latter will
|
||||
# fail if val is a Unicode containing non-ASCII characters.
|
||||
return '%s' % (val,)
|
||||
if mo.group('escaped') is not None:
|
||||
return self.delimiter
|
||||
if mo.group('invalid') is not None:
|
||||
|
@ -139,7 +142,9 @@ class Template(metaclass=_TemplateMetaclass):
|
|||
named = mo.group('named') or mo.group('braced')
|
||||
if named is not None:
|
||||
try:
|
||||
return str(mapping[named])
|
||||
# We use this idiom instead of str() because the latter
|
||||
# will fail if val is a Unicode containing non-ASCII
|
||||
return '%s' % (mapping[named],)
|
||||
except KeyError:
|
||||
return mo.group()
|
||||
if mo.group('escaped') is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue