mirror of
https://github.com/python/cpython.git
synced 2025-09-18 06:30:38 +00:00
#13579: minimize code base drift for 'a' string.Formatter change.
2.7 doesn't support 'a'. This changeset ports the doc change and clause-reording portions of Francisco Martín Brugué patch in order to minimize code base drift.
This commit is contained in:
parent
0e3a4c8058
commit
d928b6a965
2 changed files with 10 additions and 9 deletions
|
@ -601,12 +601,12 @@ class Formatter(object):
|
|||
|
||||
def convert_field(self, value, conversion):
|
||||
# do any conversion on the resulting object
|
||||
if conversion == 'r':
|
||||
return repr(value)
|
||||
if conversion is None:
|
||||
return value
|
||||
elif conversion == 's':
|
||||
return str(value)
|
||||
elif conversion is None:
|
||||
return value
|
||||
elif conversion == 'r':
|
||||
return repr(value)
|
||||
raise ValueError("Unknown conversion specifier {0!s}".format(conversion))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue