[Python-checkins] cpython: asyncio: Remove Process.subprocess attribute; it's too easy to get inconsistent

victor.stinner python-checkins at python.org
Sun Feb 9 02:52:10 CET 2014


http://hg.python.org/cpython/rev/8e00345c3b30
changeset: 89079:8e00345c3b30
user: Victor Stinner <victor.stinner at gmail.com>
date: Sun Feb 09 02:51:40 2014 +0100
summary:
 asyncio: Remove Process.subprocess attribute; it's too easy to get inconsistent
Process and Popen objects
files:
 Doc/library/asyncio-subprocess.rst | 6 +---
 Lib/asyncio/subprocess.py | 4 --
 Lib/test/test_asyncio/test_subprocess.py | 20 ------------
 3 files changed, 1 insertions(+), 29 deletions(-)
diff --git a/Doc/library/asyncio-subprocess.rst b/Doc/library/asyncio-subprocess.rst
--- a/Doc/library/asyncio-subprocess.rst
+++ b/Doc/library/asyncio-subprocess.rst
@@ -87,10 +87,6 @@
 Standard error stream (read), ``None`` if the process was created with
 ``stderr=None``.
 
- .. attribute:: subprocess
-
- Underlying :class:`subprocess.Popen` object.
-
 .. method:: communicate(input=None)
 
 Interact with process: Send data to stdin. Read data from stdout and
@@ -102,7 +98,7 @@
 :meth:`communicate` returns a tuple ``(stdoutdata, stderrdata)``.
 
 Note that if you want to send data to the process's stdin, you need to
- create the Popen object with ``stdin=PIPE``. Similarly, to get anything
+ create the Process object with ``stdin=PIPE``. Similarly, to get anything
 other than ``None`` in the result tuple, you need to give ``stdout=PIPE``
 and/or ``stderr=PIPE`` too.
 
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -106,10 +106,6 @@
 yield from waiter
 return waiter.result()
 
- @property
- def subprocess(self):
- return self._transport.get_extra_info('subprocess')
-
 def _check_alive(self):
 if self._transport.get_returncode() is not 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
@@ -7,9 +7,6 @@
 if sys.platform != 'win32':
 from asyncio import unix_events
 
-# Program exiting quickly
-PROGRAM_EXIT_FAST = [sys.executable, '-c', 'pass']
-
 # Program blocking
 PROGRAM_BLOCKED = [sys.executable, '-c', 'import time; time.sleep(3600)']
 
@@ -119,23 +116,6 @@
 returncode = self.loop.run_until_complete(proc.wait())
 self.assertEqual(-signal.SIGHUP, returncode)
 
- def test_subprocess(self):
- args = PROGRAM_EXIT_FAST
-
- @asyncio.coroutine
- def run():
- proc = yield from asyncio.create_subprocess_exec(*args,
- loop=self.loop)
- yield from proc.wait()
- # need to poll subprocess.Popen, otherwise the returncode
- # attribute is not set
- proc.subprocess.wait()
- return proc
-
- proc = self.loop.run_until_complete(run())
- self.assertEqual(proc.subprocess.returncode, proc.returncode)
- self.assertEqual(proc.subprocess.pid, proc.pid)
-
 def test_broken_pipe(self):
 large_data = b'x' * support.PIPE_MAX_SIZE
 
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /