[issue21350] bug in file.writelines accepting buffers

Brian Kearns report at bugs.python.org
Wed May 7 18:29:36 CEST 2014


Brian Kearns added the comment:

So, for example:
>>> f = open('blah', 'wb')
>>> f.write(array.array('c', 'test'))
>>> f.writelines([array.array('c', 'test')])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: writelines() argument must be a sequence of strings

While the comment in writelines says:
Check that all entries are indeed strings. If not,
apply the same rules as for file.write() and
convert the results to strings.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21350>
_______________________________________


More information about the Python-bugs-list mailing list