Author jcea
Recipients a.badger, jcea, michael.foord
Date 2014-12-07.15:24:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
mock_open(read_data=b'...') gives an error:

"""Traceback (most recent call last):
  File "", line 6, in <module>
  File "/usr/local/lib/python3.4/unittest/", line 896, in __call__
    return _mock_self._mock_call(*args, **kwargs)
  File "/usr/local/lib/python3.4/unittest/", line 962, in _mock_call
    ret_val = effect(*args, **kwargs)
  File "/usr/local/lib/python3.4/unittest/", line 2279, in _read_side_effect
    return ''.join(_data)
  File "/usr/local/lib/python3.4/unittest/", line 2244, in _iterate_read_data
    data_as_list = ['{}\n'.format(l) for l in read_data.split('\n')]

Easy to reproduce:

from unittest.mock import mock_open, patch

m = mock_open(read_data= b'abc')
with patch('', m, create=True) :
    with open('abc', 'rb') as f :

Looks like this bug was introduced as result of issue #17467. I add those people to the nosy list.
Date User Action Args
2014-12-07 15:24:17jceasetrecipients: + jcea, a.badger, michael.foord
2014-12-07 15:24:17jceasetmessageid: <>
2014-12-07 15:24:17jcealinkissue23004 messages
2014-12-07 15:24:16jceacreate