[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5

yury.selivanov python-checkins at python.org
Tue Aug 4 22:01:33 CEST 2015


https://hg.python.org/cpython/rev/32765fa158b0
changeset:   97249:32765fa158b0
parent:      97246:6d9d3a866b2b
parent:      97248:e3f381a3423d
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Tue Aug 04 15:57:05 2015 -0400
summary:
  Merge 3.5

files:
  Lib/asyncio/base_events.py               |  3 ++-
  Lib/asyncio/base_subprocess.py           |  4 ++--
  Lib/asyncio/proactor_events.py           |  4 ++--
  Lib/asyncio/selector_events.py           |  4 ++--
  Lib/asyncio/sslproto.py                  |  4 ++--
  Lib/asyncio/unix_events.py               |  5 +++--
  Lib/test/test_asyncio/test_subprocess.py |  6 +-----
  7 files changed, 14 insertions(+), 16 deletions(-)


diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -28,6 +28,7 @@
 import sys
 import warnings
 
+from . import compat
 from . import coroutines
 from . import events
 from . import futures
@@ -378,7 +379,7 @@
     # 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
--- 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 @@
     # 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
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -7,10 +7,10 @@
 __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 @@
     # 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
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -10,7 +10,6 @@
 import errno
 import functools
 import socket
-import sys
 import warnings
 try:
     import ssl
@@ -18,6 +17,7 @@
     ssl = None
 
 from . import base_events
+from . import compat
 from . import constants
 from . import events
 from . import futures
@@ -568,7 +568,7 @@
     # 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
--- 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 @@
     # 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
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -13,6 +13,7 @@
 
 from . import base_events
 from . import base_subprocess
+from . import compat
 from . import constants
 from . import coroutines
 from . import events
@@ -370,7 +371,7 @@
     # 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 @@
     # 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)
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -417,11 +417,7 @@
     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
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list