Message239854
> ITSM it's not the TextIOWrapper but the detect_encoding fails and throws an error.
Oh, right. But TextIOWrapper can fail for differen reasons. For example, CTRL+c may send KeyboardInterrupt.
Try for example:
with unittest.mock.patch.object(tokenize, '_builtin_open') as mock_open:
mock_file = mock_open.return_value
mock_file.tell.side_effect = OSError
mock_file.readline.return_value = b''
tokenize.open(fn)
This example raises an OSError in TextIOWrapper on file.tell(), and file.close() is not called. |
|
Date |
User |
Action |
Args |
2015-04-01 22:18:33 | vstinner | set | recipients:
+ vstinner, introom, itsmemattchung |
2015-04-01 22:18:33 | vstinner | set | messageid: <1427926713.32.0.983311581307.issue23840@psf.upfronthosting.co.za> |
2015-04-01 22:18:33 | vstinner | link | issue23840 messages |
2015-04-01 22:18:33 | vstinner | create | |
|