Author mjpieters
Recipients mjpieters, serhiy.storchaka, xiang.zhang
Date 2017-02-28.14:30:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488292244.28.0.832026715507.issue28598@psf.upfronthosting.co.za>
In-reply-to
Content
> Is 2.7 free from this bug?

No, 2.7 is affected too:

>>> class SubclassedStr(str):
...     def __rmod__(self, other):
...         return 'Success, self.__rmod__({!r}) was called'.format(other)
...
>>> 'lhs %% %r' % SubclassedStr('rhs')
"lhs % 'rhs'"

Expected output is "Success, self.__rmod__('lhs %% %r') was called"

On the plus side, unicode is not affected:

>>> class SubclassedUnicode(unicode):
...     def __rmod__(self, other):
...         return u'Success, self.__rmod__({!r}) was called'.format(other)
...
>>> u'lhs %% %r' % SubclassedUnicode(u'rhs')
u"Success, self.__rmod__(u'lhs %% %r') was called"
History
Date User Action Args
2017-02-28 14:30:44mjpieterssetrecipients: + mjpieters, serhiy.storchaka, xiang.zhang
2017-02-28 14:30:44mjpieterssetmessageid: <1488292244.28.0.832026715507.issue28598@psf.upfronthosting.co.za>
2017-02-28 14:30:44mjpieterslinkissue28598 messages
2017-02-28 14:30:44mjpieterscreate