Message12290

Author adamburke
Recipients adamburke
Date 2019-01-08.07:46:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1546933607.12.0.561373167814.issue2730@roundup.psfhosted.org>
In-reply-to
Content
It seems there are a few datetime.strptime() / strftime() issues, but this seems like a new variation.

On JDK 9+, Windows 10, the short name for months has changed even for English locales to include a fullstop. This causes incompatibility with CPython and earlier versions of Jython, and breaks regtests, mainly those inherited from CPython itself.

Regrtest sample output
> dist\bin\jython.exe -m test.regrtest -v test_strptime

======================================================================
ERROR: test_feb29_on_leap_year_without_year (test.test_strptime.StrptimeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Adam\jython\jython3\dist\Lib\test\test_strptime.py", line 382, in test_feb29_on_leap_year_without_year
    time.strptime("Feb 29", "%b %d")
  File "C:\Users\Adam\jython\jython3\dist\Lib\_strptime.py", line 467, in _strptime_time
    return _strptime(data_string, format)[0]
  File "C:\Users\Adam\jython\jython3\dist\Lib\_strptime.py", line 324, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data u'Feb 29' does not match format u'%b %d'

ERROR: test_mar1_comes_after_feb29_even_when_omitting_the_year (test.test_strptime.StrptimeTests)
FAIL: test_pattern (test.test_strptime.TimeRETests)

Demonstration script:
import os
import time
from datetime import date

print (os.uname())
print (os.environ['JAVA_HOME'])

print ( date(2002, 2, 4).strftime('%b %d')  )


print ( time.strptime("Jan. 29", "%b %d") ) # No ValueError
print ( time.strptime("Jan 29", "%b %d") ) # ValueError

C:\Users\Adam\jython\jython3>dist\bin\jython.exe datebug20190108.py
('Windows', '...', '10', '...', 'AMD64')
C:\Program Files\Java\jdk-11.0.1
Feb. 04
time.struct_time(tm_year=1900, tm_mon=1, tm_mday=29, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=0, tm_yday=29, tm_isdst=-1)
Traceback (most recent call last):
  File "datebug20190108.py", line 13, in <module>
    print ( time.strptime("Jan 29", "%b %d") ) # ValueError
  File "C:\Users\Adam\jython\jython3\dist\Lib\_strptime.py", line 467, in _strptime_time
    return _strptime(data_string, format)[0]
  File "C:\Users\Adam\jython\jython3\dist\Lib\_strptime.py", line 324, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data u'Jan 29' does not match format u'%b %d'
History
Date User Action Args
2019-01-08 07:46:48adamburkesetrecipients: + adamburke
2019-01-08 07:46:47adamburkesetmessageid: <1546933607.12.0.561373167814.issue2730@roundup.psfhosted.org>
2019-01-08 07:46:47adamburkelinkissue2730 messages
2019-01-08 07:46:46adamburkecreate