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

victor.stinner python-checkins at python.org
Fri Jan 30 01:22:09 CET 2015


https://hg.python.org/cpython/rev/25c1d4aea1c1
changeset:   94390:25c1d4aea1c1
parent:      94388:faf94fc9d94c
parent:      94389:c1d92f7221a5
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Jan 30 01:21:06 2015 +0100
summary:
  Merge 3.4 (asyncio)

files:
  Lib/asyncio/base_subprocess.py           |   7 ++---
  Lib/test/test_asyncio/test_subprocess.py |  16 ------------
  2 files changed, 3 insertions(+), 20 deletions(-)


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
@@ -84,6 +84,8 @@
         raise NotImplementedError
 
     def close(self):
+        if self._closed:
+            return
         self._closed = True
 
         for proto in self._pipes.values():
@@ -100,8 +102,7 @@
             except ProcessLookupError:
                 pass
 
-            # Don't clear the _proc reference yet because _post_init() may
-            # still run
+            # Don't clear the _proc reference yet: _post_init() may still run
 
     # 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
@@ -125,8 +126,6 @@
             return None
 
     def _check_proc(self):
-        if self._closed:
-            raise ValueError("operation on closed transport")
         if self._proc is None:
             raise ProcessLookupError()
 
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
@@ -47,22 +47,6 @@
                         None, None, None, 0, waiter=waiter)
         return (transport, protocol)
 
-    def test_close(self):
-        waiter = asyncio.Future(loop=self.loop)
-        transport, protocol = self.create_transport(waiter)
-        transport._process_exited(0)
-        transport.close()
-
-        # The loop didn't run yet
-        self.assertFalse(protocol.connection_made.called)
-
-        # methods must raise ProcessLookupError if the transport was closed
-        self.assertRaises(ValueError, transport.send_signal, signal.SIGTERM)
-        self.assertRaises(ValueError, transport.terminate)
-        self.assertRaises(ValueError, transport.kill)
-
-        self.loop.run_until_complete(waiter)
-
     def test_proc_exited(self):
         waiter = asyncio.Future(loop=self.loop)
         transport, protocol = self.create_transport(waiter)

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


More information about the Python-checkins mailing list