Issue2168

classification
Title: Inconsistent behaviour of time.strptime
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7, Jython 2.5
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ducky427, santa4nt
Priority: Keywords:

Created on 2014-06-17.17:42:15 by ducky427, last changed 2014-07-26.08:20:41 by zyasoft.

Messages
msg8655 (view) Author: Rohit (ducky427) Date: 2014-06-17.17:42:13
The following code throws an exception in Python 2.7 while in Jython it works. I think the Python code is correct.

Code:
import time
d = time.strptime('09302010', "%d%m%Y")

Python:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/_strptime.py", line 467, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains: 0

Jython:
time.struct_time(tm_year=2012, tm_mon=6, tm_mday=9, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=161, tm_isdst=-1)
msg8656 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-06-17.20:22:47
This has already been addressed recently in Jython 2.7.x beta development.

Jython 2.7b3+ (default:ea302f9e4c3a, Jun 17 2014, 13:24:57) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> d = time.strptime('09302010', "%d%m%Y")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/santa/Code/jython/dist/Lib/_strptime.py", line 467, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/home/santa/Code/jython/dist/Lib/_strptime.py", line 327, in _strptime
    raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: 0
msg8657 (view) Author: Rohit (ducky427) Date: 2014-06-17.20:25:16
Thanks. I tried out Jython 2.7b2. I eagerly await the next beta. 

> On 17 Jun 2014, at 21:22, Santoso Wijaya <report@bugs.jython.org> wrote:
> 
> 
> Santoso Wijaya added the comment:
> 
> This has already been addressed recently in Jython 2.7.x beta development.
> 
> Jython 2.7b3+ (default:ea302f9e4c3a, Jun 17 2014, 13:24:57) 
> [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_51
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import time
>>>> d = time.strptime('09302010', "%d%m%Y")
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/home/santa/Code/jython/dist/Lib/_strptime.py", line 467, in _strptime_time
>    return _strptime(data_string, format)[0]
>  File "/home/santa/Code/jython/dist/Lib/_strptime.py", line 327, in _strptime
>    raise ValueError("unconverted data remains: %s" %
> ValueError: unconverted data remains: 0
> 
> ----------
> nosy: +santa4nt
> type:  -> behaviour
> 
> _______________________________________
> Jython tracker <report@bugs.jython.org>
> <http://bugs.jython.org/issue2168>
> _______________________________________
History
Date User Action Args
2014-07-26 08:20:41zyasoftsetstatus: open -> closed
resolution: fixed
2014-06-17 20:25:16ducky427setmessages: + msg8657
2014-06-17 20:22:48santa4ntsettype: behaviour
messages: + msg8656
nosy: + santa4nt
2014-06-17 17:42:15ducky427create