[pypy-commit] pypy py3k: fix datetime after rounding optimizations

bdkearns noreply at buildbot.pypy.org
Tue Mar 5 07:59:34 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: py3k
Changeset: r62061:8d6f0f4e168b
Date: 2013-03-05 01:41 -0500
http://bitbucket.org/pypy/pypy/changeset/8d6f0f4e168b/

Log:	fix datetime after rounding optimizations

diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py
--- a/lib-python/3/datetime.py
+++ b/lib-python/3/datetime.py
@@ -568,10 +568,10 @@
         if isinstance(other, timedelta):
             return usec / other._to_microseconds()
         if isinstance(other, int):
-            return timedelta(0, 0, usec / other)
+            return timedelta(0, 0, round(usec / other))
         if isinstance(other, float):
             a, b = other.as_integer_ratio()
-            return timedelta(0, 0, b * usec / a)
+            return timedelta(0, 0, round(b * usec / a))
 
     def __mod__(self, other):
         if isinstance(other, timedelta):


More information about the pypy-commit mailing list