Modify

Ticket #60 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

Error loading timestamps

Reported by: miki@… Owned by: xi
Priority: normal Component: pysyck
Severity: critical Keywords:
Cc:

Description

Try the following script:

#!/usr/bin/env python

import syck
from datetime import datetime

for i in range(10000):
    now = datetime.now()
    dumped = syck.dump(now)
    loaded = syck.load(dumped)
    if now != loaded:
        print "original:", now
        print "result:", loaded
        print "dump:", dumped
        break

I get:

original: 2007-09-17 11:04:08.091612
result: 2007-09-17 11:04:08.916120
dump: --- !timestamp 2007-09-17T11:04:08.091612

The YAML looks OK, so the parsing is wrong.

Attachments

Change History

comment:1 Changed 7 years ago by miki@…

Seems like the offending code is in loaders.py 249-251

        if micro:
            while 10*micro < 1000000:
                micro *= 10

Commenting out this code makes the bug go away. I don't understand why is this code needed ...

comment:2 Changed 7 years ago by xi

  • Status changed from new to closed
  • Resolution set to fixed

Thanks for the report. Fixed in [259].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.