Author vstinner
Recipients vstinner
Date 2018-12-12.10:43:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544611398.55.0.788709270274.issue35469@psf.upfronthosting.co.za>
In-reply-to
Content
It seems like bpo-31339 introduced a regression with commit eeadf5fc231163ec97a8010754d9c995c7c14876 to fix a security issue.

Copy of of bencordova's comment from GitHub:
https://github.com/python/cpython/pull/3293#issuecomment-446378058

I'm new at commenting on this project so apologies if this is not the appropriate place to do so.

From what I can see (upgrading from python 2.7.13->2.7.15), the string format on line 648 of Modules/timemodule.c causes a different output from time.ctime() and time.asctime(t) for "days of the month < 10"

"%s %s%3d %.2d:%.2d:%.2d %d"

The "%3d" in this change removes the leading zero on the tm_mday but maintains a leading space.

Just looking for feedback on what the intention was and if this is a bug.

python 2.7.13:

>>> import time
>>> t = time.strptime("6 Dec 18", "%d %b %y")
>>> time.asctime(t)
'Thu Dec 06 00:00:00 2018'

python 2.7.15:

>>> import time
>>> t = time.strptime("6 Dec 18", "%d %b %y")
>>> time.asctime(t)
'Thu Dec  6 00:00:00 2018'

Note, the string with this change includes two spaces between "Dec" and "6" which also looks awkward.

Original Post:
https://github.com/python/cpython/commit/eeadf5fc231163ec97a8010754d9c995c7c14876#r31642310
History
Date User Action Args
2018-12-12 10:43:18vstinnersetrecipients: + vstinner
2018-12-12 10:43:18vstinnersetmessageid: <1544611398.55.0.788709270274.issue35469@psf.upfronthosting.co.za>
2018-12-12 10:43:18vstinnerlinkissue35469 messages
2018-12-12 10:43:18vstinnercreate