Message 55935 - Python tracker (original) (raw)
Looks Good, except I think it's a bad idea to release/acquire the GIL for each character when writing the repr() of a string. Given that the string is immutable and its refcount kept alive by the caller I don't see a reason why you can't just reference the object without holding the GIL. (Also you might want to copy the size into a local variable, it won't change...)