[Python-checkins] cpython: Try to fix test_time.test_AsSecondsDouble() on "x86 Gentoo Non-Debug with X
victor.stinner
python-checkins at python.org
Thu Sep 10 11:48:29 CEST 2015
https://hg.python.org/cpython/rev/bafae65793a0
changeset: 97852:bafae65793a0
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Sep 10 11:48:00 2015 +0200
summary:
Try to fix test_time.test_AsSecondsDouble() on "x86 Gentoo Non-Debug with X 3.x" buildbot
Use volatile keyword in _PyTime_Round()
files:
Python/pytime.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Python/pytime.c b/Python/pytime.c
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -75,12 +75,17 @@
static double
_PyTime_Round(double x, _PyTime_round_t round)
{
+ /* volatile avoids optimization changing how numbers are rounded */
+ volatile double d;
+
+ d = x;
if (round == _PyTime_ROUND_HALF_EVEN)
- return _PyTime_RoundHalfEven(x);
+ d = _PyTime_RoundHalfEven(d);
else if (round == _PyTime_ROUND_CEILING)
- return ceil(x);
+ d = ceil(d);
else
- return floor(x);
+ d = floor(d);
+ return d;
}
static int
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list