diff options
| author | R David Murray <rdmurray@bitdance.com> | 2012-08-19 21:57:29 (GMT) |
|---|---|---|
| committer | R David Murray <rdmurray@bitdance.com> | 2012-08-19 21:57:29 (GMT) |
| commit | d928b6a96516f611583310fd41c6c905562acd2c (patch) | |
| tree | 396d0687ba8128e6c1f66f854677bcd14b455cee /Lib/string.py | |
| parent | 0e3a4c80585ce993dc274b6cea31f283948e1c44 (diff) | |
| download | cpython-d928b6a96516f611583310fd41c6c905562acd2c.zip cpython-d928b6a96516f611583310fd41c6c905562acd2c.tar.gz cpython-d928b6a96516f611583310fd41c6c905562acd2c.tar.bz2 | |
#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.
Diffstat (limited to 'Lib/string.py')
| -rw-r--r-- | Lib/string.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/string.py b/Lib/string.py index 9c0ebe1..9727803 100644 --- a/Lib/string.py +++ b/Lib/string.py @@ -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)) |
