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!')
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):
Py_ssize_t len;
char *pos;
- pos = strchr(fmt + 1, '%');
+ pos = (char *)memchr(fmt + 1, '%', fmtcnt);
if (pos != NULL)
len = pos - fmt;
else
- len = format_len - (fmt - format);
+ len = fmtcnt + 1;
assert(len != 0);
memcpy(res, fmt, len);