[Python-Dev] PyErr_SafeFormat
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Fri, 14 Jul 2000 18:13:45 +0200
guido wrote:
> > > We don't care about anything except for %d, %s, possibly %c and =
%x.
> >=20
> > how about:
>=20
> I would suggest to build this into PyErr_Format, which is what
> everybody already uses. Instant safety. Need some more analysis of
> what format codes are actually used
greg's original mail mentioned %d, %i, %s, %c and %x, which is what
I implemented. (if my code stumbles upon any other formatting code,
it simply copies the rest of the formatting string to the output =
string.)
it also looks as if PyErr_Format is undocumented, so we could solve
this by simply writing some documentation ;-)
> and support for %.200s which is currently used often.
note that the code intentionally ignores the .200 part; as greg pointed
out, they're only used today to make sure the message doesn't overflow
PyErr_Format's buffer... but it's easy to fix.
patch coming.
</F>