mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #26766: Fix _PyBytesWriter_Finish()
Return a bytearray object when bytearray is requested and when the small buffer is used. Fix also test_bytes: bytearray%args must return a bytearray type.
This commit is contained in:
parent
12bb6f4c7d
commit
e914d41312
2 changed files with 8 additions and 3 deletions
|
@ -492,7 +492,7 @@ class BaseBytesTest:
|
|||
b = self.type2test(b'%s / 100 = %d%%')
|
||||
a = b % (b'seventy-nine', 79)
|
||||
self.assertEqual(a, b'seventy-nine / 100 = 79%')
|
||||
self.assertIs(type(a), bytes)
|
||||
self.assertIs(type(a), self.type2test)
|
||||
|
||||
def test_imod(self):
|
||||
b = self.type2test(b'hello, %b!')
|
||||
|
@ -504,7 +504,7 @@ class BaseBytesTest:
|
|||
b = self.type2test(b'%s / 100 = %d%%')
|
||||
b %= (b'seventy-nine', 79)
|
||||
self.assertEqual(b, b'seventy-nine / 100 = 79%')
|
||||
self.assertIs(type(b), bytes)
|
||||
self.assertIs(type(b), self.type2test)
|
||||
|
||||
def test_rmod(self):
|
||||
with self.assertRaises(TypeError):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue