classification
Title: Argument transport in attach and detach method in Server class in base_events file is not used
Type: behavior Stage:
Components: asyncio, Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, vajrasky, vstinner, yselivanov
Priority: normal Keywords: patch

Created on 2014-05-29 03:16 by vajrasky, last changed 2014-07-12 02:22 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
remove_transport_in_base_events.patch vajrasky, 2014-05-29 03:16 review
Messages (4)
msg219328 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2014-05-29 03:16
In Lib/asyncio/base_events.py, we have these lines of code:

-----------------------------------------------------------
    def attach(self, transport):
        assert self.sockets is not None
        self.active_count += 1

    def detach(self, transport):
        assert self.active_count > 0
        self.active_count -= 1
        if self.active_count == 0 and self.sockets is None:
            self._wakeup()
------------------------------------------------------------

The transport is not used. We can remove them. Here is the patch to remove the arguments.

If for higher philosophical reason, we need this unused argument, maybe we can comment it.
msg220996 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-19 15:48
The Server class is hardcoded in create_server() and create_unix_server(), it's not possible to pass an arbitrary class. Only the AbstractServer class is documented, and only close() and wait_for_close() methods:
https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.AbstractServer

So it's possible to break the API. The Server API is not really public.

@Guido, @Yury: what do you think?
msg222023 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-07-01 10:54
I proposed a deeper change to make most attributes and methods private:
https://code.google.com/p/tulip/issues/detail?id=180
msg222822 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-07-12 02:22
Issue fixed in changesets e6198242a537 (Python 3.4) and 5a299c3ec120 (Python 3.5).
History
Date User Action Args
2014-07-12 02:22:50vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg222822
2014-07-01 10:54:58vstinnersetmessages: + msg222023
2014-06-19 15:48:32vstinnersetmessages: + msg220996
2014-06-06 11:12:00giampaolo.rodolasetnosy: + gvanrossum, yselivanov
components: + asyncio
2014-05-29 03:16:17vajraskycreate