[Python-Dev] Checking input range in time.asctime and time.ctime
Alexander Belopolsky
alexander.belopolsky at gmail.com
Thu Jan 6 03:46:49 CET 2011
On Wed, Jan 5, 2011 at 9:18 PM, Guido van Rossum <guido at python.org> wrote:
> I'm sorry, but at this point I'm totally confused about what you're
> asking or proposing. You keep referring to various implementation
> details and behaviors. Maybe if you summarized how the latest
> implementation (say python 3.2) works and what you propose to change
I'll try. The current implementation is of time.asctime and
time.strftime is roughly
if y < 1900:
if accept2dyear:
if 69 <= y <= 99:
y += 1900
elif 0 <= y <= 68:
y += 2000
else:
raise ValueError("year out of range")
else:
raise ValueError("year out of range")
# call system function with tm_year = y - 1900
I propose to change that to
if y < 1000:
if accept2dyear:
if 69 <= y <= 99:
y += 1900
elif 0 <= y <= 68:
y += 2000
else:
raise ValueError("year out of range")
# call system function with tm_year = y - 1900
More information about the Python-Dev
mailing list