Issue2261

classification
Title: datetime with some locales: "java.lang.IllegalArgumentException: Cannot create PyString with non-byte value"
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: Arfrever, zyasoft
Priority: urgent Keywords:

Created on 2015-01-22.02:09:27 by Arfrever, last changed 2015-02-02.16:32:23 by zyasoft.

Messages
msg9441 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2015-01-22.02:09:27
$ LC_ALL="pl_PL.UTF-8" jython2.7 -c 'import datetime; print(datetime.datetime.strptime("2015-01-22", "%Y-%m-%d"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/share/jython-2.7/Lib/datetime.py", line 1504, in strptime
    return cls(*(_time.strptime(date_string, format))[0:6])
  File "/usr/share/jython-2.7/Lib/_strptime.py", line 270, in <module>
    _TimeRE_cache = TimeRE()
  File "/usr/share/jython-2.7/Lib/_strptime.py", line 188, in __init__
    self.locale_time = LocaleTime()
  File "/usr/share/jython-2.7/Lib/_strptime.py", line 71, in __init__
    self.__calc_weekday()
  File "/usr/share/jython-2.7/Lib/_strptime.py", line 91, in _LocaleTime__calc_weekday
    a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
  File "/usr/share/jython-2.7/Lib/calendar.py", line 79, in __getitem__
    return funcs(self.format)
  File "/usr/share/jython-2.7/Lib/datetime.py", line 804, in strftime
    return _wrap_strftime(self, fmt, self.timetuple())
  File "/usr/share/jython-2.7/Lib/datetime.py", line 239, in _wrap_strftime
    return _time.strftime(newformat, timetuple)
        at org.python.core.PyString.<init>(PyString.java:62)
        at org.python.core.PyString.<init>(PyString.java:68)
        at org.python.modules.time.Time.strftime(Time.java:681)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value


This bug can be reproduced with at least the following locales:
cs_CZ.UTF-8
pl_PL.UTF-8
ru_RU.UTF-8
sk_SK.UTF-8
uk_UA.UTF-8
msg9452 (view) Author: Jim Baker (zyasoft) Date: 2015-01-23.23:36:09
Fixed as of https://hg.python.org/jython/rev/5c60689c2819
History
Date User Action Args
2015-02-02 16:32:23zyasoftsetstatus: pending -> closed
2015-01-23 23:36:09zyasoftsetstatus: open -> pending
nosy: + zyasoft
messages: + msg9452
priority: urgent
assignee: zyasoft
resolution: fixed
2015-01-22 02:09:27Arfrevercreate