PyPy 3 datetime.now fails with ValueError: cannot convert float NaN to integer

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Apparently datetime.now() can fail with ValueError: cannot convert float NaN to integer:

       [2018/06/18 12:13:04.141] + /opt/python/pypy3/bin/pypy3 -c 'import sys; print(sys.version)'
       [2018/06/18 12:13:04.140] 3.2.5 (b2091e973da69152b3f928bfaabd5d2347e6df46, Oct 24 2014, 12:08:04)
       [2018/06/18 12:13:04.140] [PyPy 2.4.0 with GCC 4.8.2]
      ....
       [2018/06/18 12:14:59.745] ERROR [0.141s]: test_alt_collection (test_gridfs.TestGridfs)
       [2018/06/18 12:14:59.745] ----------------------------------------------------------------------
       [2018/06/18 12:14:59.745] Traceback (most recent call last):
       [2018/06/18 12:14:59.745]   File "/data/mci/538b97133808052c3200dffc12869fc9/src/test/test_gridfs.py", line 208, in test_alt_collection
       [2018/06/18 12:14:59.745]     self.alt.put(b"foo", filename="test")
       [2018/06/18 12:14:59.745]   File "gridfs/__init__.py", line 129, in put
       [2018/06/18 12:14:59.745]     grid_file.close()
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 311, in close
       [2018/06/18 12:14:59.746]     self.__flush()
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 288, in __flush
       [2018/06/18 12:14:59.746]     self.__flush_buffer()
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 280, in __flush_buffer
       [2018/06/18 12:14:59.746]     self.__flush_data(self._buffer.getvalue())
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 258, in __flush_data
       [2018/06/18 12:14:59.746]     self.__ensure_indexes()
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 202, in __ensure_indexes
       [2018/06/18 12:14:59.746]     self.__create_index(self._coll.chunks, _C_INDEX, True)
       [2018/06/18 12:14:59.746]   File "gridfs/grid_file.py", line 188, in __create_index
       [2018/06/18 12:14:59.746]     doc = collection.find_one(projection={"_id": 1}, session=self._session)
       [2018/06/18 12:14:59.746]   File "/data/mci/538b97133808052c3200dffc12869fc9/src/pymongo/collection.py", line 1240, in find_one
       [2018/06/18 12:14:59.746]     for result in cursor.limit(-1):
       [2018/06/18 12:14:59.746]   File "/data/mci/538b97133808052c3200dffc12869fc9/src/pymongo/cursor.py", line 1184, in next
       [2018/06/18 12:14:59.746]     if len(self.__data) or self._refresh():
       [2018/06/18 12:14:59.746]   File "/data/mci/538b97133808052c3200dffc12869fc9/src/pymongo/cursor.py", line 1099, in _refresh
       [2018/06/18 12:14:59.746]     self.__send_message(q)
       [2018/06/18 12:14:59.746]   File "/data/mci/538b97133808052c3200dffc12869fc9/src/pymongo/cursor.py", line 924, in __send_message
       [2018/06/18 12:14:59.746]     start = datetime.datetime.now()
       [2018/06/18 12:14:59.746]   File "/opt/python/pypy3/lib-python/3/datetime.py", line 1428, in now
       [2018/06/18 12:14:59.746]     return cls.fromtimestamp(t, tz)
       [2018/06/18 12:14:59.746]   File "/opt/python/pypy3/lib-python/3/datetime.py", line 1391, in fromtimestamp
       [2018/06/18 12:14:59.746]     us = _round(frac * 1e6)
       [2018/06/18 12:14:59.746]   File "/opt/python/pypy3/lib-python/3/datetime.py", line 27, in _round
       [2018/06/18 12:14:59.746]     return _math.floor(x + 0.5) if x >= 0.0 else _math.ceil(x - 0.5)
       [2018/06/18 12:14:59.746] ValueError: cannot convert float NaN to integer
      

      https://evergreen.mongodb.com/task/mongo_python_driver_tests_python_version_rhel62_test_ssl__auth~noauth_ssl~nossl_python_version~pypy3_coverage~coverage_test_3.6_standalone_709b28467fb4268e45ad30672b3b16a2e05ced2c_18_06_18_17_52_11

      I don't think this is a pymongo bug but I'm opening it now so we don't forget to report it elsewhere.

            Assignee:
            Shane Harvey
            Reporter:
            Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: