Hi, I worked on a patch to replace all socket.error, select.error, WindowsError and IOError with OSError. The problem is that I'm not sure that we keep all informations using the wrap_error() function of Trollius.
For example, socket.error has a subclass socket.gaierror. Replacing it with OSError drops the "gai" information. In Python 3.3, socket.error is just an alias to OSError, so it's fine to use socket.error in Python 2 and Python 3. I wrote some documentation to explain the current status: http://trollius.readthedocs.org/#oserror-and-socket-error-exceptions I'm no more sure that a change is required in Trollius. Victor 2014-07-15 8:13 GMT+02:00 Victor Stinner <[email protected]>: > Hi, > > You described the PEP 3151 which has been implemented in Python 3.3: > https://www.python.org/dev/peps/pep-3151 > > In Python 3.3, socket.error is an alias to OSError. In Trollius, I'm using > wrap_error(), a function wrapping socket.error and generic OSError to > specific OSError like ConnectionResetError. It looks like I forgot to wrap > the call to bind in create_server(). > > Victor > > Le lundi 14 juillet 2014, Luca Sbardella <[email protected]> a écrit > : > >> Hi, >> >> When using the create_server method on an event loop, I want to catch the >> OSError when binding to an address already in use and log a message rather >> than the full stack trace. >> >> This works in asyncio, however trollius does not raise OSError, it raises >> socket.error instead. >> Not a big deal but any reason for this discrepancy or trollius should use >> OSError too? >> >> Luca
