Message 118543 - Python tracker
> I am then confused by this in the initial comment: > > > It calls indirectly PyUnicode_EncodeUTF8() and so call > > PyBytes_FromStringAndSize() which allocates memory on the heap. > > I've not studied the patch though, so this may have changed. The patch certainly has changed, yes. In the latest patch, printing of unicode message is done one code point at a time without allocating any intermediary area.