Message208594
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(). |
|
Date |
User |
Action |
Args |
2014-01-21 00:34:16 | vstinner | set | recipients:
+ vstinner, belopolsky, pitrou, skrah, neologix, serhiy.storchaka |
2014-01-21 00:34:16 | vstinner | set | messageid: <1390264456.23.0.80941463403.issue20320@psf.upfronthosting.co.za> |
2014-01-21 00:34:16 | vstinner | link | issue20320 messages |
2014-01-21 00:34:16 | vstinner | create | |
|