Skip to content

Commit 0bf3b71

Browse files
[3.14] Fix various issues in the 'Timer File Descriptors' documentation (GH-156027) (#156481)
(cherry picked from commit 13ab4c2) Co-authored-by: Omar Sandoval <osandov@osandov.com>
1 parent f8a703a commit 0bf3b71

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

Doc/library/os.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4139,16 +4139,17 @@ Naturally, they are all only available on Linux.
41394139
- :const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)
41404140

41414141
If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide
4142-
real-time clock is used. If system clock is changed, timer setting need
4143-
to be updated. To cancel timer when system clock is changed, see
4142+
real-time clock is used. If the system clock is changed, the timer setting
4143+
needs to be updated. To cancel the timer when the system clock is changed, see
41444144
:const:`TFD_TIMER_CANCEL_ON_SET`.
41454145

41464146
If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically
41474147
increasing clock is used. Even if the system clock is changed, the timer
41484148
setting will not be affected.
41494149

4150-
If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time.CLOCK_MONOTONIC`
4151-
except it includes any time that the system is suspended.
4150+
If *clockid* is :const:`time.CLOCK_BOOTTIME`, it is the same as
4151+
:const:`time.CLOCK_MONOTONIC` except it includes any time that the system
4152+
is suspended.
41524153

41534154
The file descriptor's behaviour can be modified by specifying a *flags* value.
41544155
Any of the following variables may be used, combined using bitwise OR
@@ -4159,8 +4160,8 @@ Naturally, they are all only available on Linux.
41594160

41604161
If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until
41614162
the timer expires. If it is set as a flag, :func:`read` doesn't block, but
4162-
If there hasn't been an expiration since the last call to read,
4163-
:func:`read` raises :class:`OSError` with ``errno`` is set to
4163+
if there hasn't been an expiration since the last call to read,
4164+
:func:`read` raises :class:`OSError` with ``errno`` set to
41644165
:const:`errno.EAGAIN`.
41654166

41664167
:const:`TFD_CLOEXEC` is always set by Python automatically.
@@ -4175,7 +4176,7 @@ Naturally, they are all only available on Linux.
41754176
.. versionadded:: 3.13
41764177

41774178

4178-
.. function:: timerfd_settime(fd, /, *, flags=flags, initial=0.0, interval=0.0)
4179+
.. function:: timerfd_settime(fd, /, *, flags=0, initial=0.0, interval=0.0)
41794180

41804181
Alter a timer file descriptor's internal timer.
41814182
This function operates the same interval timer as :func:`timerfd_settime_ns`.
@@ -4190,12 +4191,11 @@ Naturally, they are all only available on Linux.
41904191
- :const:`TFD_TIMER_CANCEL_ON_SET`
41914192

41924193
The timer is disabled by setting *initial* to zero (``0``).
4193-
If *initial* is equal to or greater than zero, the timer is enabled.
4194+
If *initial* is greater than zero, the timer is enabled.
41944195
If *initial* is less than zero, it raises an :class:`OSError` exception
4195-
with ``errno`` set to :const:`errno.EINVAL`
4196+
with ``errno`` set to :const:`errno.EINVAL`.
41964197

41974198
By default the timer will fire when *initial* seconds have elapsed.
4198-
(If *initial* is zero, timer will fire immediately.)
41994199

42004200
However, if the :const:`TFD_TIMER_ABSTIME` flag is set,
42014201
the timer will fire when the timer's clock
@@ -4206,13 +4206,13 @@ Naturally, they are all only available on Linux.
42064206
If *interval* is greater than zero, the timer fires every time *interval*
42074207
seconds have elapsed since the previous expiration.
42084208
If *interval* is less than zero, it raises :class:`OSError` with ``errno``
4209-
set to :const:`errno.EINVAL`
4209+
set to :const:`errno.EINVAL`.
42104210

42114211
If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with
42124212
:const:`TFD_TIMER_ABSTIME` and the clock for this timer is
42134213
:const:`time.CLOCK_REALTIME`, the timer is marked as cancelable if the
42144214
real-time clock is changed discontinuously. Reading the descriptor is
4215-
aborted with the error ECANCELED.
4215+
aborted with the error :const:`errno.ECANCELED`.
42164216

42174217
Linux manages system clock as UTC. A daylight-savings time transition is
42184218
done by changing time offset only and doesn't cause discontinuous system

Modules/clinic/posixmodule.c.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10981,17 +10981,17 @@ os.timerfd_settime_ns
1098110981
flags: int = 0
1098210982
0 or a bit mask of TFD_TIMER_ABSTIME or TFD_TIMER_CANCEL_ON_SET.
1098310983
initial: long_long = 0
10984-
initial expiration timing in seconds.
10984+
initial expiration timing in nanoseconds.
1098510985
interval: long_long = 0
10986-
interval for the timer in seconds.
10986+
interval for the timer in nanoseconds.
1098710987
1098810988
Alter a timer file descriptor's internal timer in nanoseconds.
1098910989
[clinic start generated code]*/
1099010990

1099110991
static PyObject *
1099210992
os_timerfd_settime_ns_impl(PyObject *module, int fd, int flags,
1099310993
long long initial, long long interval)
10994-
/*[clinic end generated code: output=6273ec7d7b4cc0b3 input=261e105d6e42f5bc]*/
10994+
/*[clinic end generated code: output=6273ec7d7b4cc0b3 input=94bdcea7292157eb]*/
1099510995
{
1099610996
struct itimerspec new_value;
1099710997
struct itimerspec old_value;
@@ -11020,12 +11020,12 @@ os.timerfd_gettime
1102011020
A timer file descriptor.
1102111021
/
1102211022
11023-
Return a tuple of a timer file descriptor's (interval, next expiration) in float seconds.
11023+
Return a tuple of a timer file descriptor's (next expiration, interval) in float seconds.
1102411024
[clinic start generated code]*/
1102511025

1102611026
static PyObject *
1102711027
os_timerfd_gettime_impl(PyObject *module, int fd)
11028-
/*[clinic end generated code: output=ec5a94a66cfe6ab4 input=8148e3430870da1c]*/
11028+
/*[clinic end generated code: output=ec5a94a66cfe6ab4 input=6511475a40bc5ee6]*/
1102911029
{
1103011030
struct itimerspec curr_value;
1103111031
int result;
@@ -11046,12 +11046,12 @@ os.timerfd_gettime_ns
1104611046
A timer file descriptor.
1104711047
/
1104811048
11049-
Return a tuple of a timer file descriptor's (interval, next expiration) in nanoseconds.
11049+
Return a tuple of a timer file descriptor's (next expiration, interval) in nanoseconds.
1105011050
[clinic start generated code]*/
1105111051

1105211052
static PyObject *
1105311053
os_timerfd_gettime_ns_impl(PyObject *module, int fd)
11054-
/*[clinic end generated code: output=580633a4465f39fe input=a825443e4c6b40ac]*/
11054+
/*[clinic end generated code: output=580633a4465f39fe input=8322cb9855b40a9e]*/
1105511055
{
1105611056
struct itimerspec curr_value;
1105711057
int result;

0 commit comments

Comments
 (0)