[3.15] gh-155742: Test PyBytesWriter_FinishWithSize() with negative size (GH-155783) (#155791)
hugovk <[email protected]>
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/fe4a14eff16fd4574bc1037b1ef0a0e52718efeb commit: fe4a14eff16fd4574bc1037b1ef0a0e52718efeb branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-08-19T06:19:11+03:00 summary: [3.15] gh-155742: Test PyBytesWriter_FinishWithSize() with negative size (GH-155783) (#155791) Co-authored-by: Victor Stinner <[email protected]> files: M Lib/test/test_capi/test_bytes.py diff --git a/Lib/test/test_capi/test_bytes.py b/Lib/test/test_capi/test_bytes.py index c591e986bbce35f..d20e5016f969c2f 100644 --- a/Lib/test/test_capi/test_bytes.py +++ b/Lib/test/test_capi/test_bytes.py @@ -315,10 +315,16 @@ def test_create(self): self.assertEqual(writer.get_size(), 3) self.assertEqual(writer.finish(), self.result_type(b'abc')) + def test_finish_with_size(self): + # Test PyBytesWriter_FinishWithSize() writer = self.create_writer(10, b'abc') self.assertEqual(writer.get_size(), 10) self.assertEqual(writer.finish_with_size(3), self.result_type(b'abc')) + writer = self.create_writer(3, b'abc') + with self.assertRaises(SystemError): + writer.finish_with_size(-3) + def test_write_bytes(self): # Test PyBytesWriter_WriteBytes() writer = self.create_writer() _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]