Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r80911:6577bbdc8e76 Date: 2015-11-24 15:43 -0500 http://bitbucket.org/pypy/pypy/changeset/6577bbdc8e76/
Log: speed up datetime fromtimestamp (this check costs time) diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py --- a/lib_pypy/datetime.py +++ b/lib_pypy/datetime.py @@ -17,7 +17,6 @@ """ from __future__ import division -import numbers as _numbers import time as _time import math as _math import struct as _struct @@ -1484,13 +1483,10 @@ @classmethod def _from_timestamp(cls, converter, timestamp, tzinfo): - if isinstance(timestamp, _numbers.Integral): - us = 0 - else: - t_full = timestamp - timestamp = int(_math.floor(timestamp)) - frac = t_full - timestamp - us = _round(frac * 1e6) + t_full = timestamp + timestamp = int(_math.floor(timestamp)) + frac = t_full - timestamp + us = _round(frac * 1e6) # If timestamp is less than one microsecond smaller than a # full second, us can be rounded up to 1000000. In this case, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit