gh-157242: Add byteswriter_check_consistency() #157723

Merged
vstinner opened 8:33pm on September 17, 2026 wanted to merge 194 ฮ” into python/cpython main from
bytes_mutate
Diff Delta:
194
About 389 Diff Delta/hour
Classified as:  Feature Add

vstinner's Description of Work

Add byteswriter_check_consistency() to check that the bytes/bytearray object can be mutated. It is called by all PyBytesWriter functions.


  • Add test_thread to PyBytesWriter tests.

  • _PyBytes_IsMutable() now checks _PyObject_IsUniquelyReferenced().


  • Issue: gh-157242
    <!-- /gh-issue-number -->

4 total changed files
(1 file ignored)
Loading changes...
Loading changes...
PR terminus reached:
Thus concludes todayโ€™s episode of โ€œJust One Small Changeโ€