Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-254

PyPy: datetime deserialization yields wrong value

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      PyPy 1.5

      Running this script on CPython works, but crashes on PyPy:

      import json
      import datetime

      from bson.json_util import default, object_hook
      from bson.tz_util import utc

      data = datetime.datetime(2011, 1, 1, 1, 1, 1, 191000, utc)
      data2 = json.loads(json.dumps(data, default=default), object_hook=object_hook)

      assert data == data2, (data, data2)

      The microseconds (191000) are unserialized to a wrong value (190999).

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            jonash Jonas H
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: