mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
PyUnicodeWriter_Create(length) no longer allocates 'length' characters immediately. The allocation of the buffer is now done lazily at the first write, except if the read-only optimization is used. So the read-only optimization can also be used even if length is greater than 0. No longer overallocate the first buffer (at the first write). Only overallocate when the buffer is resized (at the second write). It avoids the need to truncate in PyUnicodeWriter_Finish() when PyUnicodeWriter_Create(length) used the exact output length. Add get_buffer() method to writer tests.
Source files for various builtin objects