[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your contribution Pablo. The issue is fixed in 3.6 and 3.7. It is hard to fix it in 2.7. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset ed267e3305a54eddae8106bdaae2c62d4c3b7db6 by Serhiy Storchaka in branch '2.7': [2.7] bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (GH-4003). (#4031) https://github.com/python/cpython/commit/ed2

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 95602b368b87da3702a0f340ded2a23e823bb104 by Serhiy Storchaka (Pablo Galindo) in branch '3.6': [3.6] bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (GH-4003). (#4022) https://github.com/python/cp

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +4005 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-17 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +3997 stage: backport needed -> patch review ___ Python tracker ___ ___ Python-bu

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-17 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- stage: patch review -> backport needed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsub

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 2c15b29aea5d6b9c61aa42d2c24a07ff1edb4b46 by Serhiy Storchaka (Pablo Galindo) in branch 'master': bpo-31786: Make functions in the select module blocking when timeout is a small negative value. (#4003) https://github.com/python/cpython/commit/2

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-16 Thread Riccardo Coccioli
Change by Riccardo Coccioli : -- nosy: +Riccardo Coccioli ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-16 Thread STINNER Victor
STINNER Victor added the comment: > It seems like _PyTime_ROUND_CEILING is not needed in Python currently. Oops, my pending PR 3983 uses _PyTime_ROUND_CEILING :-) Please keep it. -- ___ Python tracker __

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-16 Thread STINNER Victor
STINNER Victor added the comment: Ok, so it seems like we need 3 rounding modes: * _PyTime_ROUND_FLOOR: read a clock, like datetime.datetime.now(). We need to round nanoseconds since datetime.datetime only supports 1 us resolution * _PyTime_ROUND_HALF_EVEN: "round from a Python float" like ro

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I have updated both the test and the implementation to address your feedback. -- ___ Python tracker ___ ___

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Pablo. The initial test leaked a thread, now it is much better. Could you please make the test testing different timeout values: None, -1, -1.0, -0.1, -1e-100? -- ___ Python tracker

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread Pablo
Pablo added the comment: I have added a Pull Request fixing this issue. The current implementation is checking in the syscall if the value for ms before rounding was negative. To test for this, I call poll.poll in a thread and check that the thread is alive after a join with timeout (so this

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This particular issue can be fixed by adding the condition (PyFloat_Check(timeout_obj) && PyFloat_AsDouble(timeout_obj) < 0). The problem is only with writing good test for infinity timeout. This test could be also used for testing issue31334. --

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread Berker Peksag
Change by Berker Peksag : -- nosy: +berker.peksag ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-15 Thread STINNER Victor
STINNER Victor added the comment: I suggest to implement ROUND_UP in pytime and use it in all functions accepting a timeout, not only poll. Search for ROUND_CEILING in the code to find them. But functions accepting time like clock_settime() must continue to use ROUND_CEILING. Does someone want

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-14 Thread Pablo
Change by Pablo : -- keywords: +patch pull_requests: +3976 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailin

[issue31786] In select.poll.poll() ms can be 0 if timeout < 0

2017-10-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : According to the documentation select.poll.poll() is blocked for infinite timeout if the timeout argument is negative. But due to rounding it is possible that timeout < 0, but an integer ms passed to the poll() syscall is 0, and poll() is not blocked. --