[Python-Dev] changing time.strftime() to accept 0s (was: User's complaints)

Brett Cannon brett at python.org
Wed Jul 12 04:50:05 CEST 2006


On 7/11/06, skip at pobox.com <skip at pobox.com> wrote:
>
>     Brett> That whole entry is a little overblown.
>
> Well, sure.  Think of it as a bug report with attitude. ;-)
>
>     Brett> That was done to fix buffer overflow issues when libc
>     Brett> implementations didn't do bound checks on the arguments to
>     Brett> strftime() and would index too far...
>
> That special case could simply be recognized and converted into one that
> works couldn't it?  Documented or not, I believe it was the standard idiom
> for formatting just a date before 2.4.
>
>     http://python.org/sf/1520914
>
> Keep or toss as you see fit.  Seems like breakage that could have been
> avoided to me though.


Right, but that would have required realizing how to prevent it at the
time.  =)

I can change it so that 0 is an acceptable value and internally handles
defaulting to something reasonable (accepting less than 9 values in the
tuple is a separate thing that I don't feel like bothering to implement).
It does possibly hide bugs where 0 was not meant to be passed, though.

If people think this is a reasonable thing to change, then Neal and Anthony,
do you want it to go into 2.5?

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060711/7593f880/attachment.html 


More information about the Python-Dev mailing list