Message11724

Author jeff.allen
Recipients jeff.allen, psykiatris
Date 2018-02-27.23:54:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519775655.46.0.467229070634.issue2649@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for bringing this up.

This isn't really to do with calendars. gc.getDisplayName(2,2,loc) returns a java.util.HashMap and our __repr__ for that is trying to force the Unicode it contains into byte-strings. Simpler demonstration:

>>> from java.util import GregorianCalendar
>>> from java.util import Locale
>>> gc = GregorianCalendar()
>>> names = gc.getDisplayNames(2, 2, Locale.KOREAN)
>>> dict(names)
{u'4\uc6d4': 3, u'3\uc6d4': 2, u'2\uc6d4': 1, u'1\uc6d4': 0, u'12\uc6d4': 11, u'10\uc6d4': 9, u'11\uc6d4': 10, u'9\uc6d4': 8, u'8\uc6d4': 7, u'7\uc6d4': 6, u'6\uc6d4': 5, u'5\uc6d4': 4}

But look at names with print or in the REPL and it blows up.

>>> names
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
        at org.python.core.PyString.<init>(PyString.java:57)
        at org.python.core.PyString.<init>(PyString.java:70)
        at org.python.core.PyString.<init>(PyString.java:74)
        at org.python.core.JavaProxyMap$2.__call__(JavaProxyMap.java:115)
        at org.python.core.PyObjectDerived.__repr__(PyObjectDerived.java:104)
...
History
Date User Action Args
2018-02-27 23:54:15jeff.allensetmessageid: <1519775655.46.0.467229070634.issue2649@psf.upfronthosting.co.za>
2018-02-27 23:54:15jeff.allensetrecipients: + jeff.allen, psykiatris
2018-02-27 23:54:15jeff.allenlinkissue2649 messages
2018-02-27 23:54:14jeff.allencreate