This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients kbk, ned.deily, roger.serwy, serhiy.storchaka, terry.reedy, tim.peters
Date 2013-12-09.21:10:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> [2.7] print() implicitly converts str and bytearray subclasses to str and left unicode subclasses as is.

This strikes me as possibly a bug in print, but even if that were changed, there is still the issue of sys.stdout.write and pickle. While the patch is a great improvement, it changes the behavior of sys.stdout.write(s), which acts like it calls str.__str__(s) rather than str(s) == s.__str__

class S(str):
    def __str__(self):
        return 'S: ' + str.__str__(self)

s = S('foo')
print(s, str(s), str.__str__(s))

import sys
S: foo S: foo foo

on the console (hang after first line on Idle)

I am testing the patch with str(s) changed to str.__str__(s).
Date User Action Args
2013-12-09 21:10:40terry.reedysetrecipients: + terry.reedy, tim.peters, kbk, ned.deily, roger.serwy, serhiy.storchaka
2013-12-09 21:10:40terry.reedysetmessageid: <>
2013-12-09 21:10:40terry.reedylinkissue19481 messages
2013-12-09 21:10:40terry.reedycreate