Author vstinner
Recipients belopolsky, neologix, pitrou, serhiy.storchaka, skrah, vstinner
Date 2014-01-21.00:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1390264456.23.0.80941463403.issue20320@psf.upfronthosting.co.za>
In-reply-to
Content
Rounding issue causes performance bug in asyncio, see issue #20311 for the rationale. This issue address bugs for select and kqueue because their implementation is different.

OS multiplexer:

- select: microsecond resolution (10^-6), timeout converted by _PyTime_ObjectToTimeval() which converts 1e-7 to zero => BUG!
- kqueue: nanosecond resolution (10^-9), timeout converted by _PyTime_ObjectToTimespec() which converts 1e-10 to zero => BUG!

_PyTime_ObjectToTimeval() is used in various places:

- datetime.datetime.fromtimestamp(), datetime.datetime.utcfromtimestamp()
- select.select(), 

_PyTime_ObjectToTimespec() is used in various places:

- posix.utime()
- signal.sigtimedwait()
- select.kqueue.control()
- time.clock_settime()

Attached patch adds a new round parameter to _PyTime_ObjectToTimeval() and _PyTime_ObjectToTimespec() to choose the rounding method:

* _PyTime_ROUND_DOWN: Round towards zero. (current implementation)
* _PyTime_ROUND_UP: Round away from zero. (new rounding method)

The patch changes the rounding method for select, kqueue but also for sigtimedwait().
History
Date User Action Args
2014-01-21 00:34:16vstinnersetrecipients: + vstinner, belopolsky, pitrou, skrah, neologix, serhiy.storchaka
2014-01-21 00:34:16vstinnersetmessageid: <1390264456.23.0.80941463403.issue20320@psf.upfronthosting.co.za>
2014-01-21 00:34:16vstinnerlinkissue20320 messages
2014-01-21 00:34:16vstinnercreate