2014/1/14 Jonathan Slenders <[email protected]>:
> Jonathans-MacBook-Pro:~ jonathan$ python /tmp/test_pty.py
> kqueue seems to support PTY
> Jonathans-MacBook-Pro:~ jonathan$ sw_vers -productVersion
> 10.9

So kqueue was improved in OS X Maverick (10.9).

Guido wrote:
> If someone really wants to use PTYs on affected OS X boxes
>  they can start by forcing the affected apps to use the select selector

The workaround is not so easy:
---
import sys, platform
if sys.platform == 'darwin':
    version_txt = platform.mac_ver()[0]
    version = tuple(map(int, version_txt.split('.')))
    if version < (10, 9):
        import selectors, asyncio
        from asyncio.unix_events import SelectorEventLoop
        selector = selectors.SelectSelector()
        asyncio.set_event_loop(SelectorEventLoop(selector))
---

What do you think of the opposite? Use select.select() on OS X < 10.9
by default, but explain how to force select.epoll if you don't care of
PTY?

This discussion remembers me a Python issue proposing to add a
function to get the best selector depending on different criteria like
"don't use a file descriptor for the poller" (use poll instead of
epoll).

FYI Apple provides the Maverick upgrade for free (!) for Mac OS X
users. I will upgrade my iMac (which currently runs Mac OS 10.6.8) :-)

Victor

Reply via email to