On Tue, Feb 25, 2014 at 9:00 AM, Victor Stinner <[email protected]>wrote:
> 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? > All three of these sound fine. > > 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'm -0 on all of these. I want Tulip to be a shining example of Python 3 code, not an example of how to write code that also works with Python 2. > 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. > If Richard Oudkerk agrees I'm fine with this. > There is still the question of introducing "yield From(...)" syntax in > Trollius... > I'm in favor... -- --Guido van Rossum (python.org/~guido)
