diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-09-13 16:14:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-13 16:14:55 +0300 |
commit | 6638c9226066205a646e18da95b33e619d784b0b (patch) | |
tree | fd8b1e83046f215cea16a7104345c2ad9dd63411 /Lib/asyncio | |
parent | 4556b1d35c352c975f3cf066362cb6e24efe0668 (diff) | |
download | cpython-git-6638c9226066205a646e18da95b33e619d784b0b.tar.gz |
[3.8] bpo-38148: Add slots to asyncio transports (GH-16077) (GH-16093)
* bpo-38148: Add slots to asyncio transports
* Update Misc/NEWS.d/next/Library/2019-09-13-08-55-43.bpo-38148.Lnww6D.rst
Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 9eb35ab0d71a6bd680e84fa0f828cb634e72b681)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/transports.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py index 47b37fa9b7..513b1c024a 100644 --- a/Lib/asyncio/transports.py +++ b/Lib/asyncio/transports.py @@ -9,6 +9,8 @@ __all__ = ( class BaseTransport: """Base class for transports.""" + __slots__ = ('_extra',) + def __init__(self, extra=None): if extra is None: extra = {} @@ -44,6 +46,8 @@ class BaseTransport: class ReadTransport(BaseTransport): """Interface for read-only transports.""" + __slots__ = () + def is_reading(self): """Return True if the transport is receiving.""" raise NotImplementedError @@ -68,6 +72,8 @@ class ReadTransport(BaseTransport): class WriteTransport(BaseTransport): """Interface for write-only transports.""" + __slots__ = () + def set_write_buffer_limits(self, high=None, low=None): """Set the high- and low-water limits for write flow control. @@ -154,10 +160,14 @@ class Transport(ReadTransport, WriteTransport): except writelines(), which calls write() in a loop. """ + __slots__ = () + class DatagramTransport(BaseTransport): """Interface for datagram (UDP) transports.""" + __slots__ = () + def sendto(self, data, addr=None): """Send data to the transport. @@ -180,6 +190,8 @@ class DatagramTransport(BaseTransport): class SubprocessTransport(BaseTransport): + __slots__ = () + def get_pid(self): """Get subprocess id.""" raise NotImplementedError @@ -247,6 +259,8 @@ class _FlowControlMixin(Transport): resume_writing() may be called. """ + __slots__ = ('_loop', '_protocol_paused', '_high_water', '_low_water') + def __init__(self, extra=None, loop=None): super().__init__(extra) assert loop is not None |