[Python-Dev] TypeError messages

Eric V. Smith eric at trueblade.com
Fri Feb 20 17:11:25 CET 2015


On 02/20/2015 09:05 AM, Brett Cannon wrote:
>     Some messages (only in C) truncate actual type name (%.50s, %.80s,
>     %.200s, %.500s). Should type name be truncated at all and for how limit?
> 
> 
> I assume this is over some worry of string size blowing out memory
> allocation or something? If someone can show that's an actual worry then
> fine, otherwise I say don't truncate.

I asked about this years ago, and was told it was in case the type name
pointer was bad, and to limit the amount of garbage printed. Whether
that's an actual problem or not, I can't say. It seems more likely that
you'd get a segfault, but maybe if it was pointing to reused memory it
could be useful.

Eric.



More information about the Python-Dev mailing list