Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Doc/library/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,9 @@ compatible with the Python codec registry.

Writes the object's contents encoded to the stream.

.. versionchanged:: next
Returns the number of characters or bytes written to the stream.


.. method:: writelines(list)

Expand Down
2 changes: 1 addition & 1 deletion Lib/codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def write(self, object):
""" Writes the object's contents encoded to self.stream.
"""
data, consumed = self.encode(object, self.errors)
self.stream.write(data)
return self.stream.write(data)

def writelines(self, list):

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:meth:`codecs.StreamWriter.write` and
``codecs.StreamReaderWriter.write`` now return the number of characters
or bytes written.
Loading