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. --Guido van Rossum (home page: http://www.python.org/~guido/)