[Python-Dev] TypeError messages

Guido van Rossum guido at python.org
Sat Feb 21 09:03:16 CET 2015


IIRC there's a limited buffer used for the formatting. Also, if a
dynamically created type name is 1000000 characters long I'd rather see it
truncated than blow up my shell window.

On Friday, February 20, 2015, Eric V. Smith <eric at trueblade.com> wrote:

> 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.
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org <javascript:;>
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>


-- 
--Guido van Rossum (on iPad)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150221/e4446d77/attachment-0001.html>


More information about the Python-Dev mailing list