summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2017-10-18 08:12:47 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-18 08:12:47 (GMT)
commit95602b368b87da3702a0f340ded2a23e823bb104 (patch)
tree48698f6120f2e0ee60d3df01a3fefc9531d3473d /Include
parent178148025494c4058571831fb11fc8eeff8b7365 (diff)
downloadcpython-95602b368b87da3702a0f340ded2a23e823bb104.zip
cpython-95602b368b87da3702a0f340ded2a23e823bb104.tar.gz
cpython-95602b368b87da3702a0f340ded2a23e823bb104.tar.bz2
[3.6] bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (GH-4003). (#4022)
(cherry picked from commit 2c15b29aea5d6b9c61aa42d2c24a07ff1edb4b46)
Diffstat (limited to 'Include')
-rw-r--r--Include/pytime.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/Include/pytime.h b/Include/pytime.h
index 87ac7fc..9e1f304 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -29,9 +29,20 @@ typedef enum {
_PyTime_ROUND_CEILING=1,
/* Round to nearest with ties going to nearest even integer.
For example, used to round from a Python float. */
- _PyTime_ROUND_HALF_EVEN
+ _PyTime_ROUND_HALF_EVEN=2,
+ /* Round away from zero
+ For example, used for timeout. _PyTime_ROUND_CEILING rounds
+ -1e-9 to 0 milliseconds which causes bpo-31786 issue.
+ _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps
+ the timeout sign as expected. select.poll(timeout) must block
+ for negative values." */
+ _PyTime_ROUND_UP=3,
+ /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be
+ used for timeouts. */
+ _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP
} _PyTime_round_t;
+
/* Convert a time_t to a PyLong. */
PyAPI_FUNC(PyObject *) _PyLong_FromTime_t(
time_t sec);