To fix the bug I made a very small change to the implementation of time.strptime, which is also used by datetime.strptime, maybe about 4 lines. We use the same tests as CPython here, which is part of the problem, because they don't have sufficient coverage. (Otherwise, we would not be finding this bug now.) So we do strive for complete compatibility.

The specific implementation of time.strptime does translate some format strings to their Java equivalents as used by java.text.SimpleDateFormat, but otherwise uses parsing code specific to Jython.

In general, Jython 2.5.x tries to be as compatible with CPython as possible, including the standard library. This is especially the case for what might be considered "core" standard library, including such modules as datetime. Unfortunately we are going to not be adding support for East Asian (CJK) codecs, bz2, and some missing parts of unicodedata for 2.5.2. Once again, they will be deferred, this time to 2.6. (The workaround remains to use equivalent Java libraries.)

We are planning for a release candidate of Jython 2.5.2 for this weekend.

- Jim

On Tue, Oct 5, 2010 at 3:22 PM, Benjamin Scherrey <scherrey@proteus-tech.com> wrote:
Thanx for the quick response Jim. I was banging my head thinking I had
screwed up my environment or something cause I couldn't imagine I was
the first to hit this problem. :-) So is the new implementation going
to be feature compatible with CPython or still use Java's format
strings (which I understand are a bit different from your post on the
issue)?

 -- Ben

On Wed, Oct 6, 2010 at 12:08 AM, Jim Baker <jbaker@zyasoft.com> wrote:
> This bug has been fixed in trunk and will be part of the forthcoming release
> candidate (http://bugs.jython.org/issue1662). It in fact was due to an
> unterminated quote, as the error below reports, because the quoting in
> Jython's strptime didn't properly terminate quoted characters if the literal
> was the last character in the parse format, as we see with ISO 8601
> formatted timestamps with a 'Z' timezone to indicate UTC time.
>
> On Sat, Oct 2, 2010 at 7:37 AM, Benjamin Scherrey
> <scherrey@proteus-tech.com> wrote:
>>
>> Trying to execute the following code works under c-python but fails
>> under jython:
>>
>> import datetime
>> datetime.datetime.strptime("2010-07-05T09:20:24Z","%Y-%m-%dT%H:%M:%SZ")
>>
>> results under Jython 2.5.2b1 (Release_2_5_2beta1:7075, Jun 28 2010,
>> 07:44:20):
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>>  File "/opt/jython2.5.2b1/Lib/datetime.py", line 1499, in strptime
>>    return cls(*(_time.strptime(date_string, format))[0:6])
>>        at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:783)
>>        at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:576)
>>        at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:501)
>>        at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:476)
>>        at org.python.modules.time.Time.strptime(Time.java:707)
>>        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:616)
>>
>> java.lang.IllegalArgumentException:
>> java.lang.IllegalArgumentException: Unterminated quote
>>
>>
>> results under Python 2.6.4 (r264:75706, Jun 16 2010, 19:34:45):
>> datetime.datetime(2010, 7, 5, 9, 20, 24)
>>
>> Did I get something wrong?
>>
>>  -- Ben
>>
>>
>> ------------------------------------------------------------------------------
>> Start uncovering the many advantages of virtual appliances
>> and start using them to simplify application deployment and
>> accelerate your shift to cloud computing.
>> http://p.sf.net/sfu/novell-sfdev2dev
>> _______________________________________________
>> Jython-users mailing list
>> Jython-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jython-users
>
>