diff options
Diffstat (limited to 'Lib/asyncio')
| -rw-r--r-- | Lib/asyncio/base_events.py | 3 | ||||
| -rw-r--r-- | Lib/asyncio/base_subprocess.py | 4 | ||||
| -rw-r--r-- | Lib/asyncio/proactor_events.py | 4 | ||||
| -rw-r--r-- | Lib/asyncio/selector_events.py | 4 | ||||
| -rw-r--r-- | Lib/asyncio/sslproto.py | 4 | ||||
| -rw-r--r-- | Lib/asyncio/unix_events.py | 5 | 
6 files changed, 13 insertions, 11 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index f6cc88f098..c20544545b 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -28,6 +28,7 @@ import traceback  import sys  import warnings +from . import compat  from . import coroutines  from . import events  from . import futures @@ -378,7 +379,7 @@ class BaseEventLoop(events.AbstractEventLoop):      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if not self.is_closed():                  warnings.warn("unclosed event loop %r" % self, ResourceWarning) diff --git a/Lib/asyncio/base_subprocess.py b/Lib/asyncio/base_subprocess.py index a6971b1d85..6851cd2b88 100644 --- a/Lib/asyncio/base_subprocess.py +++ b/Lib/asyncio/base_subprocess.py @@ -1,8 +1,8 @@  import collections  import subprocess -import sys  import warnings +from . import compat  from . import futures  from . import protocols  from . import transports @@ -116,7 +116,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if not self._closed:                  warnings.warn("unclosed transport %r" % self, ResourceWarning) diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 9c2b8f155a..abe4c129c9 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -7,10 +7,10 @@ proactor is only implemented on Windows with IOCP.  __all__ = ['BaseProactorEventLoop']  import socket -import sys  import warnings  from . import base_events +from . import compat  from . import constants  from . import futures  from . import sslproto @@ -79,7 +79,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if self._sock is not None:                  warnings.warn("unclosed transport %r" % self, ResourceWarning) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 7c5b9b5b9a..4a9965849e 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -10,7 +10,6 @@ import collections  import errno  import functools  import socket -import sys  import warnings  try:      import ssl @@ -18,6 +17,7 @@ except ImportError:  # pragma: no cover      ssl = None  from . import base_events +from . import compat  from . import constants  from . import events  from . import futures @@ -568,7 +568,7 @@ class _SelectorTransport(transports._FlowControlMixin,      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if self._sock is not None:                  warnings.warn("unclosed transport %r" % self, ResourceWarning) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index 235855e21e..e566946e22 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -1,11 +1,11 @@  import collections -import sys  import warnings  try:      import ssl  except ImportError:  # pragma: no cover      ssl = None +from . import compat  from . import protocols  from . import transports  from .log import logger @@ -317,7 +317,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin,      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if not self._closed:                  warnings.warn("unclosed transport %r" % self, ResourceWarning) diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 75e7c9ccad..bf3b0844fd 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -13,6 +13,7 @@ import warnings  from . import base_events  from . import base_subprocess +from . import compat  from . import constants  from . import coroutines  from . import events @@ -370,7 +371,7 @@ class _UnixReadPipeTransport(transports.ReadTransport):      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if self._pipe is not None:                  warnings.warn("unclosed transport %r" % self, ResourceWarning) @@ -555,7 +556,7 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,      # On Python 3.3 and older, objects with a destructor part of a reference      # cycle are never destroyed. It's not more the case on Python 3.4 thanks      # to the PEP 442. -    if sys.version_info >= (3, 4): +    if compat.PY34:          def __del__(self):              if self._pipe is not None:                  warnings.warn("unclosed transport %r" % self, ResourceWarning)  | 
