[Python-Dev] pymalloc and overallocation
Sat, 27 Apr 2002 00:42:20 -0400
> Yet another idea: decode into a fixed-size stack-allocated buffer. If
> it fits in that buffer, use PyString_FromStringAndSize(). Otherwise,
> do the overallocation thing.
How come we can't use a version of C that pulls this trick for us
automatically <wink>? We do end up there a lot.
Here's a patch that does it for PyUnicode_EncodeUTF8: