mirror of
https://github.com/python/cpython.git
synced 2025-10-05 14:41:07 +00:00
[3.6] bpo-29714: Fix a regression that bytes format may fail when containing zero bytes inside. (GH-504)
This commit is contained in:
parent
4e1a065c20
commit
df6d7b406f
3 changed files with 15 additions and 2 deletions
|
@ -507,6 +507,11 @@ class BaseBytesTest:
|
|||
a = b % (b'seventy-nine', 79)
|
||||
self.assertEqual(a, b'seventy-nine / 100 = 79%')
|
||||
self.assertIs(type(a), self.type2test)
|
||||
# issue 29714
|
||||
b = self.type2test(b'hello,\x00%b!')
|
||||
b = b % b'world'
|
||||
self.assertEqual(b, b'hello,\x00world!')
|
||||
self.assertIs(type(b), self.type2test)
|
||||
|
||||
def test_imod(self):
|
||||
b = self.type2test(b'hello, %b!')
|
||||
|
@ -519,6 +524,11 @@ class BaseBytesTest:
|
|||
b %= (b'seventy-nine', 79)
|
||||
self.assertEqual(b, b'seventy-nine / 100 = 79%')
|
||||
self.assertIs(type(b), self.type2test)
|
||||
# issue 29714
|
||||
b = self.type2test(b'hello,\x00%b!')
|
||||
b %= b'world'
|
||||
self.assertEqual(b, b'hello,\x00world!')
|
||||
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