File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828import sys
2929import warnings
3030
31+ from . import compat
3132from . import coroutines
3233from . import events
3334from . import futures
@@ -378,7 +379,7 @@ def is_closed(self):
378379 # On Python 3.3 and older, objects with a destructor part of a reference
379380 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
380381 # to the PEP 442.
381- if sys . version_info >= ( 3 , 4 ) :
382+ if compat . PY34 :
382383 def __del__ (self ):
383384 if not self .is_closed ():
384385 warnings .warn ("unclosed event loop %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change 11import collections
22import subprocess
3- import sys
43import warnings
54
5+ from . import compat
66from . import futures
77from . import protocols
88from . import transports
@@ -116,7 +116,7 @@ def close(self):
116116 # On Python 3.3 and older, objects with a destructor part of a reference
117117 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
118118 # to the PEP 442.
119- if sys . version_info >= ( 3 , 4 ) :
119+ if compat . PY34 :
120120 def __del__ (self ):
121121 if not self ._closed :
122122 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change 77__all__ = ['BaseProactorEventLoop' ]
88
99import socket
10- import sys
1110import warnings
1211
1312from . import base_events
13+ from . import compat
1414from . import constants
1515from . import futures
1616from . import sslproto
@@ -79,7 +79,7 @@ def close(self):
7979 # On Python 3.3 and older, objects with a destructor part of a reference
8080 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
8181 # to the PEP 442.
82- if sys . version_info >= ( 3 , 4 ) :
82+ if compat . PY34 :
8383 def __del__ (self ):
8484 if self ._sock is not None :
8585 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change 1010import errno
1111import functools
1212import socket
13- import sys
1413import warnings
1514try :
1615 import ssl
1716except ImportError : # pragma: no cover
1817 ssl = None
1918
2019from . import base_events
20+ from . import compat
2121from . import constants
2222from . import events
2323from . import futures
@@ -568,7 +568,7 @@ def close(self):
568568 # On Python 3.3 and older, objects with a destructor part of a reference
569569 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
570570 # to the PEP 442.
571- if sys . version_info >= ( 3 , 4 ) :
571+ if compat . PY34 :
572572 def __del__ (self ):
573573 if self ._sock is not None :
574574 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change 11import collections
2- import sys
32import warnings
43try :
54 import ssl
65except ImportError : # pragma: no cover
76 ssl = None
87
8+ from . import compat
99from . import protocols
1010from . import transports
1111from .log import logger
@@ -317,7 +317,7 @@ def close(self):
317317 # On Python 3.3 and older, objects with a destructor part of a reference
318318 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
319319 # to the PEP 442.
320- if sys . version_info >= ( 3 , 4 ) :
320+ if compat . PY34 :
321321 def __del__ (self ):
322322 if not self ._closed :
323323 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change 1313
1414from . import base_events
1515from . import base_subprocess
16+ from . import compat
1617from . import constants
1718from . import coroutines
1819from . import events
@@ -370,7 +371,7 @@ def close(self):
370371 # On Python 3.3 and older, objects with a destructor part of a reference
371372 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
372373 # to the PEP 442.
373- if sys . version_info >= ( 3 , 4 ) :
374+ if compat . PY34 :
374375 def __del__ (self ):
375376 if self ._pipe is not None :
376377 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
@@ -555,7 +556,7 @@ def close(self):
555556 # On Python 3.3 and older, objects with a destructor part of a reference
556557 # cycle are never destroyed. It's not more the case on Python 3.4 thanks
557558 # to the PEP 442.
558- if sys . version_info >= ( 3 , 4 ) :
559+ if compat . PY34 :
559560 def __del__ (self ):
560561 if self ._pipe is not None :
561562 warnings .warn ("unclosed transport %r" % self , ResourceWarning )
Original file line number Diff line number Diff line change @@ -417,11 +417,7 @@ def kill_running():
417417 def test_popen_error (self ):
418418 # Issue #24763: check that the subprocess transport is closed
419419 # when BaseSubprocessTransport fails
420- if sys .platform == 'win32' :
421- target = 'asyncio.windows_utils.Popen'
422- else :
423- target = 'subprocess.Popen'
424- with mock .patch (target ) as popen :
420+ with mock .patch ('subprocess.Popen' ) as popen :
425421 exc = ZeroDivisionError
426422 popen .side_effect = exc
427423
You can’t perform that action at this time.
0 commit comments