diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-30 10:49:27 -0400 |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-30 10:49:27 -0400 |
commit | 802d45b6604b82ee636fdd795cc6a7d9e655855d (patch) | |
tree | c9d51cf8a24d9dbe295985d1823dc23efb1aa570 /Lib/string.py | |
parent | 5844436adfa48b91ccd328c0bfd6ab1237a1311d (diff) | |
parent | e90982111ae1accc2a2ecaae94650a1d16a772ff (diff) | |
download | cpython-802d45b6604b82ee636fdd795cc6a7d9e655855d.tar.gz cpython-802d45b6604b82ee636fdd795cc6a7d9e655855d.zip |
Merge 3.5
Diffstat (limited to 'Lib/string.py')
-rw-r--r-- | Lib/string.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/string.py b/Lib/string.py index f3365c67fb4..e7b692d7f79 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -112,10 +112,7 @@ class Template(metaclass=_TemplateMetaclass): # Check the most common path first. named = mo.group('named') or mo.group('braced') if named is not None: - 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,) + return str(mapping[named]) if mo.group('escaped') is not None: return self.delimiter if mo.group('invalid') is not None: @@ -142,9 +139,7 @@ class Template(metaclass=_TemplateMetaclass): named = mo.group('named') or mo.group('braced') if named is not None: try: - # We use this idiom instead of str() because the latter - # will fail if val is a Unicode containing non-ASCII - return '%s' % (mapping[named],) + return str(mapping[named]) except KeyError: return mo.group() if mo.group('escaped') is not None: |