This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-10-15.09:40:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAMpsgwaXP4=NUjA=Yyjp-L1z-Up7+_+NWVYGsKMGSebbVkfsxg@mail.gmail.com>
In-reply-to <1507968428.08.0.213398074469.issue31786@psf.upfronthosting.co.za>
Content
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 to work on such patch? The new rounding mode must be test
in test_time, you should just add the new mode at the top once if I recall
correctly.

---

select.poll currently uses ROUND_CEILING: round towards +infinity.

It looks like you would prefer ROUND_UP: round away from zero, right?

In the history of CPython, the rounding mode of functions accepting time,
timeout, duration, etc. changed many times, mostly because the C code
changed in subtle ways to fix different bugs. I mean that the exact
rounding mode wasn't really chosen on purpose. I'm now trying to get better
defined rouding modes in pytime, but it seems poll uses the wrong one.

https://haypo.github.io/pytime.html

I think that my problem is that I wanted to reuse the same rounding modes
for different use cases. It seems like clocks need ROUND_CEILING but
timeouts need ROUND_UP. Well, in the case of poll, the previous code before
moving to pytime was using ceil() which uses ROUND_CEILING.
History
Date User Action Args
2017-10-15 09:40:42vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-10-15 09:40:42vstinnerlinkissue31786 messages
2017-10-15 09:40:41vstinnercreate