[Python-Dev] How long the wrong type of argument should we limit (or not) in the error message (C-api)?

Nick Coghlan ncoghlan at gmail.com
Sun Dec 15 02:25:10 CET 2013

On 15 December 2013 09:52, Victor Stinner <victor.stinner at gmail.com> wrote:
> 2013/12/15 Antoine Pitrou <solipsis at pitrou.net>:
>> Shouldn't we have a special "%T" shortcut instead of trying to
>> harmonize all the occurrences of `"%.400s", Py_TYPE(self)->tp_name` ?
> Oh, I like this proposition! The following pattern is very common in Python:
> "... %.400s ...", Py_TYPE(self)->tp_name

Oh, yes, a %T shortcut for "length limited type name of the supplied
object" would be brilliant. We need this frequently for C level error
messages, and I almost always have to look at an existing example to
remember the exact incantation :)


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list