Merge pull request #5262 from asottile/mode_non_binary
Remove 'b' from sys.stdout.mode
This commit is contained in:
commit
c8f7e50c47
|
@ -0,0 +1 @@
|
|||
Ensure that ``sys.stdout.mode`` does not include ``'b'`` as it is a text stream.
|
|
@ -447,6 +447,10 @@ class EncodedFile(object):
|
|||
"""Ensure that file.name is a string."""
|
||||
return repr(self.buffer)
|
||||
|
||||
@property
|
||||
def mode(self):
|
||||
return self.buffer.mode.replace("b", "")
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(object.__getattribute__(self, "buffer"), name)
|
||||
|
||||
|
|
|
@ -1051,6 +1051,9 @@ class TestFDCapture(object):
|
|||
cap.done()
|
||||
pytest.raises(AttributeError, cap.suspend)
|
||||
|
||||
def test_capfd_sys_stdout_mode(self, capfd):
|
||||
assert "b" not in sys.stdout.mode
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def saved_fd(fd):
|
||||
|
|
Loading…
Reference in New Issue