Demian Brecht added the comment: Thanks for the patch Aaron. Unfortunately this doesn't quite fix the issue. There are two problems with the patch:
If a bytes object is passed into mock_open, I'd expect a bytes object in the output. In your patch, not only is this not the case (the output is a string object), but the bytes object is being coerced into its string representation in the resulting list. For example (simplified from your patch): >>> data = b'foo\nbar' >>> newline = b'\n' >>> >>> ['{}\n'.format(l) for l in data.split(newline)] ["b'foo'\n", "b'bar'\n"] What I would expect to see in this case is: [b'foo\n', b'bar\n'] ---------- nosy: +demian.brecht _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23004> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com