~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2009-12-16 22:29:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4920.
  • Revision ID: robertc@robertcollins.net-20091216222931-wbbn5ey4mwmpatwd
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2074
2074
    return concurrency
2075
2075
 
2076
2076
 
2077
 
class StreamWriter(codecs.StreamWriter):
 
2077
class UnicodeOrBytesToBytesWriter(codecs.StreamWriter):
2078
2078
    """A stream writer that doesn't decode str arguments."""
2079
2079
 
2080
2080
    def __init__(self, codec, stream, errors='strict'):
2082
2082
        self.encode = codec.encode
2083
2083
 
2084
2084
    def write(self, object):
2085
 
        if type(object) == str:
 
2085
        if type(object) is str:
2086
2086
            self.stream.write(object)
2087
2087
        else:
2088
2088
            data, _ = self.encode(object, self.errors)