Skip to content

Commit 4e824e9

Browse files
willingcmiss-islington
authored andcommitted
bpo-33649: Polish asyncio subprocess and sync docs (GH-9285)
Second pass for asyncio subprocess and sync docs. https://bugs.python.org/issue33649
1 parent 11194c8 commit 4e824e9

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Doc/library/asyncio-subprocess.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ Creating Subprocesses
6262

6363
The *limit* argument sets the buffer limit for :class:`StreamReader`
6464
wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
65-
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr*
66-
arguments).
65+
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
6766

6867
Return a :class:`~asyncio.subprocess.Process` instance.
6968

@@ -78,15 +77,14 @@ Creating Subprocesses
7877

7978
The *limit* argument sets the buffer limit for :class:`StreamReader`
8079
wrappers for :attr:`Process.stdout` and :attr:`Process.stderr`
81-
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr*
82-
arguments).
80+
(if :attr:`subprocess.PIPE` is passed to *stdout* and *stderr* arguments).
8381

8482
Return a :class:`~asyncio.subprocess.Process` instance.
8583

8684
See the documentation of :meth:`loop.subprocess_shell` for other
8785
parameters.
8886

89-
.. note::
87+
.. important::
9088

9189
It is the application's responsibility to ensure that all whitespace and
9290
metacharacters are quoted appropriately to avoid `shell injection
@@ -98,7 +96,8 @@ Creating Subprocesses
9896
.. note::
9997

10098
The default event loop that asyncio is pre-configured
101-
to use on **Windows** does not support subprocesses.
99+
to use on **Windows** does not support subprocesses. Subprocesses are
100+
available for Windows if the :class:`ProactorEventLoop` is used.
102101
See :ref:`Subprocess Support on Windows <asyncio-windows-subprocess>`
103102
for details.
104103

@@ -206,7 +205,7 @@ communicate with them.
206205
exception is ignored. This condition occurs when the process
207206
exits before all data are written into *stdin*.
208207

209-
If its desired to send data to the process' *stdin*,
208+
If it is desired to send data to the process' *stdin*,
210209
the process needs to be created with ``stdin=PIPE``. Similarly,
211210
to get anything other than ``None`` in the result tuple, the
212211
process has to be created with ``stdout=PIPE`` and/or
@@ -265,8 +264,8 @@ communicate with them.
265264
Use the :meth:`communicate` method rather than
266265
:attr:`process.stdin.write() <stdin>`,
267266
:attr:`await process.stdout.read() <stdout>` or
268-
:attr:`await process.stderr.read <stderr>`
269-
to avoid deadlocks due to streams pausing reading or writing
267+
:attr:`await process.stderr.read <stderr>`.
268+
This avoids deadlocks due to streams pausing reading or writing
270269
and blocking the child process.
271270

272271
.. attribute:: pid

Doc/library/asyncio-sync.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ those of the :mod:`threading` module with two important caveats:
1313
be used for OS threads synchronization (use :mod:`threading` for
1414
that);
1515

16-
* methods of synchronization objects do not accept the *timeout*
16+
* methods of synchronization primitives do not accept the *timeout*
1717
argument; use the :func:`asyncio.wait_for` function to perform
1818
operations with timeouts.
1919

20-
asyncio has the following basic primitives:
20+
asyncio has the following basic sychronization primitives:
2121

2222
* :class:`Lock`
2323
* :class:`Event`
@@ -72,7 +72,7 @@ Lock
7272

7373
When the lock is *locked*, reset it to *unlocked* and return.
7474

75-
If the lock is *unlocked* a :exc:`RuntimeError` is raised.
75+
If the lock is *unlocked*, a :exc:`RuntimeError` is raised.
7676

7777
.. method:: locked()
7878

@@ -97,7 +97,7 @@ Event
9797
Example::
9898

9999
async def waiter(event):
100-
print('waiting ...')
100+
print('waiting for it ...')
101101
await event.wait()
102102
print('... got it!')
103103

0 commit comments

Comments
 (0)