IMO the drain() method must be declared as a coroutine to avoid to explain the "unused return value". Here is a patch: http://codereview.appspot.com/68800045
Victor 2014-02-25 18:00 GMT+01:00 Victor Stinner <[email protected]>: > Hi, > > Using "hg merge", I build this huge diff between Trollius and Tulip: > https://codereview.appspot.com/68210047/ > > Enjoy! I leaved some comments (I didn't check tests/ yet). You can > also use "hg diff -r trollius:default" in Trollius repository to get > the diff. > > Remarks: > > - a new asyncio.coroutines module is needed to break an import cycle > - initially, i wrote the new asyncio.executor module to run easily > unit tests with Python 2.7: only mock.py is needed to run tests > - the code to log traceback is still ugly, especially > Future.set_exception() which formats immediatly the exception. Storing > the whole traceback may keep some local variables alive too long. i > plan to enhance it with the new debug flag. > > What can be done to simplify merges from Tulip into Trollius: > > - create also asyncio.coroutines in Tulip > - replace "unittest.mock" with "mock" in all unit tests > - add also the COPYING file? > > I should maybe make futures dependency mandatory to avoid the > "synchrounous executor" hack and so remove asyncio.executor. I now try > to use the tox tool instead to build a clean virtual environment with > all dependencies. See required backported modules per Python version: > http://trollius.readthedocs.org/#backports > > Modify Tulip code to make it compatible with Python 2.6 may make it uglier: > > - modify classes to inherit from object > - add parameters to super() > - replace list.clear() (and bytearray.clear()) with del list[:] > - replace "{} {}" with "{0} {1}" > - replace {... for ..} with set(... for ...) and {key:value for ...} > with dict(key:value for ...) > - replace OSError with socket.error (deprecated alias to OSError), > OSError with WindowsError for overlapped operations > > I don't remember why I added "assert len(self._accept_futures)==0, > self._accept_futures; self._accept_futures.clear()" to > BaseProactorEventLoop._start_serving(), it's probably old debug code > when I improve proactor on Windows. > > Windows proactor code has many "finish" methods. It would be nice to > rename them, it would help debug. I renamed some of them in Trollius. > I also moved functions out of methods when possible. > > There is still the question of introducing "yield From(...)" syntax in > Trollius... > > Victor
