[issue30807] setitimer() can disable timer by mistake

2017-10-13 Thread STINNER Victor
STINNER Victor added the comment: New changeset ef611c96eab0ab667ebb43fdf429b319f6d99890 by Victor Stinner in branch 'master': bpo-30807: signal.setitimer() now uses _PyTime API (GH-3865)

[issue30807] setitimer() can disable timer by mistake

2017-10-03 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +3845 ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- resolution: -> fixed stage: backport needed -> resolved status: open -> closed ___ Python tracker ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset 5741b70acf88846a0d3b2d348535f250577b2df6 by Antoine Pitrou in branch '3.5': [3.5] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2498) https://github.com/python/cpython/commit/5741b70acf88846a0d3b2d348535f250577b2df6

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset a45a99b47ff241ce0ae2f0bba59b89e4e012d47c by Antoine Pitrou in branch '2.7': [2.7] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2499) https://github.com/python/cpython/commit/a45a99b47ff241ce0ae2f0bba59b89e4e012d47c

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset 6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d by Antoine Pitrou in branch '3.6': [3.6] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2497) https://github.com/python/cpython/commit/6f3cb059fd1f3a57ffd70c9d54a394a85a6ea13d

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- pull_requests: +2559 ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- pull_requests: +2560 ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- pull_requests: +2558 ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: It "shall fail" apparently :-) http://pubs.opengroup.org/onlinepubs/9699919799/functions/setitimer.html -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread STINNER Victor
STINNER Victor added the comment: What is the behaviour of setitimer() when the timeout is negative? Is this behaviour well defined (portable)? -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: patch review -> backport needed ___ Python tracker ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: (I must admit your latest explanations lost me. Why shouldn't I use _PyTime_ObjectToTimeval(), which is a convenience function, and instead use several functions in a row to get the right conversion?) -- ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: New changeset 729780a810bbcb12b245a1b652302a601fc9f6fd by Antoine Pitrou in branch 'master': bpo-30807: signal.setitimer() may disable the timer by mistake (#2493) https://github.com/python/cpython/commit/729780a810bbcb12b245a1b652302a601fc9f6fd --

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, I will just push the original fix then :-) -- ___ Python tracker ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread STINNER Victor
STINNER Victor added the comment: Antoine Pitrou added the comment: > It seems _PyTime_ObjectToTimeval() would be better here. What do you think? Oh, I forgot to document why _PyTime_ObjectToTimeval() still exists :-) The _PyTime_t type supports a range of [-292 years, +292 years]: it's enough

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: It seems _PyTime_ObjectToTimeval() would be better here. What do you think? -- ___ Python tracker ___

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread STINNER Victor
STINNER Victor added the comment: > Also using the PyTime APIs will make it annoying to backport to 2.7 (which > isn't mandatory, of course). If you want to fix 2.7, I think that your simple test to round "manually" to 1 microsecond is enough. --

[issue30807] setitimer() can disable timer by mistake

2017-06-30 Thread STINNER Victor
STINNER Victor added the comment: Antoine Pitrou added the comment: > If I use the PyTime APIs, it will change the signature from > setitimer($module, which, seconds, interval=0.0, /) > to > setitimer($module, which, seconds, interval=None, /). > > I'm not sure that's ok in a bugfix release?

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Also using the PyTime APIs will make it annoying to backport to 2.7 (which isn't mandatory, of course). -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: If I use the PyTime APIs, it will change the signature from setitimer($module, which, seconds, interval=0.0, /) to setitimer($module, which, seconds, interval=None, /). I'm not sure that's ok in a bugfix release? --

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, it's not select(), it's epoll_wait(). I see. -- ___ Python tracker ___

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't understand how 0.1 ms can be rounded down to 0 in a "struct timeval", which has microsecond precision. -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread STINNER Victor
STINNER Victor added the comment: > Not sure why? If you pass 0 instead of a tiny value, select() shouldn't > behave significantly differently. I used select() as an example of function where we also changed how the timeout was rounded, so we had to decide how to handle backward

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: needs patch -> patch review ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Well, select.select() is a better example. I had nightmare with the rounding of its timeout Not sure why? If you pass 0 instead of a tiny value, select() shouldn't behave significantly differently. In any case, I don't want to have nightmares, I simply

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread STINNER Victor
STINNER Victor added the comment: > sigtimedwait() is different: zero doesn't mean anything special. If you > mistake zero for 1e-6 or the reverse, it works fine. Well, select.select() is a better example. I had nightmare with the rounding of its timeout :-) --

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: sigtimedwait() is different: zero doesn't mean anything special. If you mistake zero for 1e-6 or the reverse, it works fine. -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I would prefer to reuse pytime.c conversion code which is well tested by > test_time. _PyTime_FromObject() already contains code to convert a double to > _PyTime_t, and _PyTime_AsTimeval() converts a _PyTime_t to timeval. Use > _PyTime_ROUND_CEILING as

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: It's not about correctly rounding something, it's about fixing a bug. I don't care about rounding if it means being a microsecond late. -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread STINNER Victor
STINNER Victor added the comment: I'm not sure about modifying Python 2.7. For example, we didn't change the select module in Python 2.7 to round correctly the timeout. -- ___ Python tracker

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread STINNER Victor
STINNER Victor added the comment: I would prefer to reuse pytime.c conversion code which is well tested by test_time. _PyTime_FromObject() already contains code to convert a double to _PyTime_t, and _PyTime_AsTimeval() converts a _PyTime_t to timeval. Use _PyTime_ROUND_CEILING as

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- pull_requests: +2552 ___ Python tracker ___ ___

[issue30807] setitimer() can disable timer by mistake

2017-06-29 Thread Antoine Pitrou
New submission from Antoine Pitrou: The C setitimer() function supports intervals with microsecond resolution. However, Python's setitimer() takes a float and then converts it to a C `struct timeval`, which can round down to zero. The consequence is that the timer is disabled (timeval ==