mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs. This can break possible code (datetime module needed changing, for instance) that uses 0 for values that need to be greater 1 or greater (month, day, and day of year). Fixes bug #897625.
This commit is contained in:
parent
0a4977c2f3
commit
d1080a3418
6 changed files with 112 additions and 4 deletions
|
@ -38,7 +38,7 @@ def strftest(now):
|
|||
if now[3] < 12: ampm='(AM|am)'
|
||||
else: ampm='(PM|pm)'
|
||||
|
||||
jan1 = time.localtime(time.mktime((now[0], 1, 1) + (0,)*6))
|
||||
jan1 = time.localtime(time.mktime((now[0], 1, 1, 0, 0, 0, 0, 1, 0)))
|
||||
|
||||
try:
|
||||
if now[8]: tz = time.tzname[1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue