summaryrefslogtreecommitdiff
path: root/Lib/collections
diff options
context:
space:
mode:
authorBatuhan Taşkaya <47358913+isidentical@users.noreply.github.com>2019-05-21 23:27:36 +0300
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-21 13:27:36 -0700
commit7abf8c60819d5749e6225b371df51a9c5f1ea8e9 (patch)
treef8051a2d600e0faeb7e025e031c26a4287b7e5ef /Lib/collections
parent565b4f1ac7304d1e690c404ca8316f383ba60862 (diff)
downloadcpython-git-7abf8c60819d5749e6225b371df51a9c5f1ea8e9.tar.gz
bpo-25652: Fix __rmod__ of UserString (GH-13326)
The ``__rmod__`` method of ``collections.UserString`` class had a bug that made it unusable. https://bugs.python.org/issue25652
Diffstat (limited to 'Lib/collections')
-rw-r--r--Lib/collections/__init__.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 960d82a5dc..cb7f1bb1fc 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -1214,9 +1214,8 @@ class UserString(_collections_abc.Sequence):
__rmul__ = __mul__
def __mod__(self, args):
return self.__class__(self.data % args)
- def __rmod__(self, format):
- return self.__class__(format % args)
-
+ def __rmod__(self, template):
+ return self.__class__(str(template) % self)
# the following methods are defined in alphabetical order:
def capitalize(self): return self.__class__(self.data.capitalize())
def casefold(self):