Re: [Python-Dev] Replace useless %.100s by %s in PyErr_Format()

2011-03-30 Thread M.-A. Lemburg
Victor Stinner wrote: > Le jeudi 24 mars 2011 à 13:22 +0100, M.-A. Lemburg a écrit : >> BTW: Why do you think that %.100s is not supported in >> PyErr_Format() in Python 2.x ? PyString_FromFormatV() >> does support this. The change to use Unicode error strings >> introduced the problem, since PyUni

Re: [Python-Dev] Replace useless %.100s by %s in PyErr_Format()

2011-03-24 Thread Victor Stinner
Le jeudi 24 mars 2011 à 13:22 +0100, M.-A. Lemburg a écrit : > BTW: Why do you think that %.100s is not supported in > PyErr_Format() in Python 2.x ? PyString_FromFormatV() > does support this. The change to use Unicode error strings > introduced the problem, since PyUnicode_FromFormatV() for > som

Re: [Python-Dev] Replace useless %.100s by %s in PyErr_Format()

2011-03-24 Thread Martin v. Löwis
> I would like to replace %.100s because there are no more reason to > truncate strings to an arbitrary length. I agree with MAL. It protects against cases with ridiculously long parameters - say, you have a string with 1GB. You *want* to truncate bogus text. Regards, Martin _

Re: [Python-Dev] Replace useless %.100s by %s in PyErr_Format()

2011-03-24 Thread M.-A. Lemburg
Victor Stinner wrote: > Hi, > > I plan to replace all %.100s (or any other size, %\.[0-9]+s regex) by %s > in the whole source code, in all calls to PyErr_Format(). And I would > like your opinion. > > When Guido added the function PyErr_Format(), 13 years ago, the function > was implemented usin

[Python-Dev] Replace useless %.100s by %s in PyErr_Format()

2011-03-24 Thread Victor Stinner
Hi, I plan to replace all %.100s (or any other size, %\.[0-9]+s regex) by %s in the whole source code, in all calls to PyErr_Format(). And I would like your opinion. When Guido added the function PyErr_Format(), 13 years ago, the function was implemented using a buffer of 500 bytes (allocated on