mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
#2538: bytes objects can only provide read-only buffers
This commit is contained in:
parent
07431a302a
commit
2f89aa6785
4 changed files with 13 additions and 8 deletions
|
@ -453,6 +453,11 @@ class BaseBytesTest(unittest.TestCase):
|
|||
class BytesTest(BaseBytesTest):
|
||||
type2test = bytes
|
||||
|
||||
def test_buffer_is_readonly(self):
|
||||
with open(sys.stdin.fileno(), "rb", buffering=0) as f:
|
||||
self.assertRaises(TypeError, f.readinto, b"")
|
||||
|
||||
|
||||
class ByteArrayTest(BaseBytesTest):
|
||||
type2test = bytearray
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue