[patch #100895 ] PyErr_Format (was: Re: [Python-Dev] Patches)

M.-A. Lemburg mal@lemburg.com
Thu, 20 Jul 2000 18:07:11 +0200

Fredrik Lundh wrote:
> greg wrote:
> > > Yes, but it would by possible to use snprintf in PyErr_Format.
> >
> > still not quite the same. /F's PyErr_Format returns an arbitrary length
> > string. snprintf() would be cut at some pre-specified limit.
> if I understood GvR correctly, the only remaining issue here
> is whether we need more formatting codes
> (PyErr_Format is undocumented, so I'm not sure we need to
> be backwards compatible with code outside the interpreter...)
> comments?

How about this:

You add your new PyErr_Format() replacement with the existing
subset of codes, but instead of bailing out when the function
sees a format code it doesn't understand, you use sprintf()
or snprintf() (where available) to format the unkown code ?!

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/