Re: issue 2166 - datetime.strptime does not support %f on Jython 2.7

Jeff Allen <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <[email protected]>
I don't think #2166 is fixed. However, we are offered this against it: 
https://github.com/jythontools/jython/pull/7 as a result of Indra's 
antipodean sprint. (See his message 7 August.) It would be senseless to 
duplicate. It has some technical problems, but it seems to be along the 
lines Tony identified. I've added a note on the bug-tracker.

Tony: that was an unlucky choice, given the number of open bugs, but 
you're very welcome to contribute. Have you managed to set up a 
development environment from which you can work?

Jeff

On 11/08/2014 17:05, Santoso Wijaya wrote:
> Time.java has changed since then. I believe this issue was addressed, 
> as well, along with issue 2112 (http://bugs.jython.org/issue2112#) in 
> the linked change.
>
> ~/santoso
>
>
> On Sun, Aug 10, 2014 at 11:57 PM, Anthony Kong 
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Hi all,
>
>     I would like to make some contribution to the jython project. I
>     browsed the bug tracker and randomly picked this issue as a
>      starting point: http://bugs.jython.org/issue2166
>
>     I think this is the cause of the bug:
>
>
>     In src/org/python/modules/time/Time.java, function 'private static
>     PyTuple pystrptime(String data_string, String format)' , it calls
>     _strptime._strptime_time to parse the data_string according to the
>     format. But this function does not understand '%f' flag.
>
>
>
>     >>> from _strptime import _strptime_time
>
>     >>> _strptime_time('2014-06-16 17:03:58.483000', '%Y-%m-%d
>     %H:%M:%S.%f')
>
>     time.struct_time(tm_year=2014, tm_mon=6, tm_mday=16, tm_hour=17,
>     tm_min=3, tm_sec=58, tm_wday=0, tm_yday=167, tm_isdst=-1)
>
>
>     If we call _strptime instead, we will get this result instead:
>
>     >>> from _strptime import _strptime
>
>     >>> _strptime('2014-06-16 17:03:58.483000', '%Y-%m-%d %H:%M:%S.%f')
>
>     (time.struct_time(tm_year=2014, tm_mon=6, tm_mday=16, tm_hour=17,
>     tm_min=3, tm_sec=58, tm_wday=0, tm_yday=167, tm_isdst=-1), 483000)
>
>
>     I am not sure what is the best way to fix this problem. Does it
>     make sense to switch to use _strptime when there is a %f flag
>     presence? I would love to hear some suggestions so I can learn
>     more the jython codebase, and hopefully, be able to patch it and
>     give something back to the community.
>
>
>     Thanks, Tony
>
>

------------------------------------------------------------------------------

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.