[Python-Dev] Checking input range in time.asctime and time.ctime

Victor Stinner victor.stinner at haypocalc.com
Thu Jan 6 12:47:22 CET 2011


Le mercredi 05 janvier 2011 à 23:48 -0500, Alexander Belopolsky a
écrit :
> I would be happy with just
> 
>    if accept2dyear:
>        if 69 <= y <= 99:
>            y += 1900
>        elif 0 <= y <= 68:
>            y += 2000
>    # call system function with tm_year = y - 1900

Perfect. That's what I expect from a "2 digits" option: it should not
touch 3 (100..999) or 4 digits digits (>= 1000).

Remember that the "2 digit option" is a hack to workaround the y2k bug.
It is maybe time to try to remove the workaround: disable accept2dyear
by default and remove PYTHONY2K env var.

> but I thought that would be too radical.

Why ?

Victor



More information about the Python-Dev mailing list