import sys
import warnings
+from . import compat
from . import coroutines
from . import events
from . import futures
# 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)
import collections
import subprocess
-import sys
import warnings
+from . import compat
from . import futures
from . import protocols
from . import transports
# 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)
__all__ = ['BaseProactorEventLoop']
import socket
-import sys
import warnings
from . import base_events
+from . import compat
from . import constants
from . import futures
from . import sslproto
# 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)
import errno
import functools
import socket
-import sys
import warnings
try:
import ssl
ssl = None
from . import base_events
+from . import compat
from . import constants
from . import events
from . import futures
# 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)
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
# 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)
from . import base_events
from . import base_subprocess
+from . import compat
from . import constants
from . import coroutines
from . import events
# 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)
# 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)
def test_popen_error(self):
# Issue #24763: check that the subprocess transport is closed
# when BaseSubprocessTransport fails
- if sys.platform == 'win32':
- target = 'asyncio.windows_utils.Popen'
- else:
- target = 'subprocess.Popen'
- with mock.patch(target) as popen:
+ with mock.patch('subprocess.Popen') as popen:
exc = ZeroDivisionError
popen.side_effect = exc