bpo-31773: time.perf_counter() uses again double#3964
bpo-31773: time.perf_counter() uses again double#3964vstinner merged 2 commits intopython:masterfrom vstinner:perf_counter_double
Conversation
|
This PR fixes a regression of the commit a997c7b which caused precision loss in time.clock() and time.perf_counter() on Windows. |
time.clock() and time.perf_counter() now use again C double internally. Remove also _PyTime_GetWinPerfCounterWithInfo(): use _PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.
Modules/timemodule.c
Outdated
| return NULL; | ||
| } | ||
| return _PyFloat_FromPyTime(t); | ||
| return PyFloat_FromDouble(d); |
There was a problem hiding this comment.
Maybe just return perf_counter(info)?
Python/pytime.c
Outdated
| { | ||
| #ifdef MS_WINDOWS | ||
| return _PyTime_GetWinPerfCounterWithInfo(t, info); | ||
| return win_perf_counter(&d, info); |
There was a problem hiding this comment.
&d -> d
The compiler emits a warning, but not an error.
There was a problem hiding this comment.
Oops, I didn't have time to test my change. It's now fixed (and I tested it this time).
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Fix also a typo in win_perf_counter()
|
Thanks for the review @serhiy-storchaka! |
time.clock() and time.perf_counter() now use again C double
internally.
Remove also _PyTime_GetWinPerfCounterWithInfo(): use
_PyTime_GetPerfCounterDoubleWithInfo() instead on Windows.
https://bugs.python.org/issue31773