[Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default
Georg Brandl
g.brandl at gmx.net
Sat Mar 17 16:49:37 CET 2012
On 03/15/2012 01:17 AM, victor.stinner wrote:
> http://hg.python.org/cpython/rev/27441e0d6a75
> changeset: 75672:27441e0d6a75
> user: Victor Stinner <victor.stinner at gmail.com>
> date: Thu Mar 15 01:17:09 2012 +0100
> summary:
> Issue #10278: Add an optional strict argument to time.steady(), False by default
>
> files:
> Doc/library/time.rst | 7 +++-
> Lib/test/test_time.py | 10 +++++
> Modules/timemodule.c | 58 +++++++++++++++++++++---------
> 3 files changed, 57 insertions(+), 18 deletions(-)
>
>
> diff --git a/Doc/library/time.rst b/Doc/library/time.rst
> --- a/Doc/library/time.rst
> +++ b/Doc/library/time.rst
> @@ -226,7 +226,7 @@
> The earliest date for which it can generate a time is platform-dependent.
>
>
> -.. function:: steady()
> +.. function:: steady(strict=False)
>
> .. index::
> single: benchmarking
> @@ -236,6 +236,11 @@
> adjusted. The reference point of the returned value is undefined so only the
> difference of consecutive calls is valid.
>
> + If available, a monotonic clock is used. By default, if *strict* is False,
> + the function falls back to another clock if the monotonic clock failed or is
> + not available. If *strict* is True, raise an :exc:`OSError` on error or
> + :exc:`NotImplementedError` if no monotonic clock is available.
This is not clear to me. Why wouldn't it raise OSError on error even with
strict=False? Please clarify which exception is raised in which case.
Georg
More information about the Python-Dev
mailing list