Skip to content

Commit 1486799

Browse files
Issue #22369: Change "context manager protocol" to "context management protocol".
1 parent 964feab commit 1486799

File tree

16 files changed

+41
-41
lines changed

16 files changed

+41
-41
lines changed

Doc/library/asyncio-sync.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Lock
3434

3535
:meth:`acquire` is a coroutine and should be called with ``yield from``.
3636

37-
Locks also support the context manager protocol. ``(yield from lock)``
37+
Locks also support the context management protocol. ``(yield from lock)``
3838
should be used as context manager expression.
3939

4040
Usage::
@@ -229,7 +229,7 @@ Semaphore
229229
counter can never go below zero; when :meth:`acquire` finds that it is zero,
230230
it blocks, waiting until some other thread calls :meth:`release`.
231231

232-
Semaphores also support the context manager protocol.
232+
Semaphores also support the context management protocol.
233233

234234
The optional argument gives the initial value for the internal counter; it
235235
defaults to ``1``. If the value given is less than ``0``, :exc:`ValueError`

Doc/library/mailbox.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
202202
.. versionchanged:: 3.2
203203
The file object really is a binary file; previously it was incorrectly
204204
returned in text mode. Also, the file-like object now supports the
205-
context manager protocol: you can use a :keyword:`with` statement to
205+
context management protocol: you can use a :keyword:`with` statement to
206206
automatically close it.
207207

208208
.. note::

Doc/library/multiprocessing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ Connection objects are usually created using :func:`Pipe` -- see also
10461046
using :meth:`Connection.send` and :meth:`Connection.recv`.
10471047

10481048
.. versionadded:: 3.3
1049-
Connection objects now support the context manager protocol -- see
1049+
Connection objects now support the context management protocol -- see
10501050
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
10511051
connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
10521052

@@ -1503,7 +1503,7 @@ their parent process exits. The manager classes are defined in the
15031503
The address used by the manager.
15041504

15051505
.. versionchanged:: 3.3
1506-
Manager objects support the context manager protocol -- see
1506+
Manager objects support the context management protocol -- see
15071507
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the
15081508
server process (if it has not already started) and then returns the
15091509
manager object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`.
@@ -1995,7 +1995,7 @@ with the :class:`Pool` class.
19951995
:meth:`terminate` before using :meth:`join`.
19961996

19971997
.. versionadded:: 3.3
1998-
Pool objects now support the context manager protocol -- see
1998+
Pool objects now support the context management protocol -- see
19991999
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
20002000
pool object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`.
20012001

@@ -2168,7 +2168,7 @@ multiple connections at the same time.
21682168
unavailable then it is ``None``.
21692169

21702170
.. versionadded:: 3.3
2171-
Listener objects now support the context manager protocol -- see
2171+
Listener objects now support the context management protocol -- see
21722172
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
21732173
listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
21742174

Doc/library/ossaudiodev.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ and (read-only) attributes:
165165
data written is always equal to the amount of data supplied.
166166

167167
.. versionchanged:: 3.2
168-
Audio device objects also support the context manager protocol, i.e. they can
168+
Audio device objects also support the context management protocol, i.e. they can
169169
be used in a :keyword:`with` statement.
170170

171171

@@ -357,7 +357,7 @@ The mixer object provides two file-like methods:
357357
Returns the file handle number of the open mixer device file.
358358

359359
.. versionchanged:: 3.2
360-
Mixer objects also support the context manager protocol.
360+
Mixer objects also support the context management protocol.
361361

362362

363363
The remaining methods are specific to audio mixing:

Doc/library/tarfile.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ be finalized; only the internally used file object will be closed. See the
238238
:ref:`tar-examples` section for a use case.
239239

240240
.. versionadded:: 3.2
241-
Added support for the context manager protocol.
241+
Added support for the context management protocol.
242242

243243
.. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, dereference=False, ignore_zeros=False, encoding=ENCODING, errors='surrogateescape', pax_headers=None, debug=0, errorlevel=0)
244244

Doc/library/threading.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ called in the locked state; it changes the state to unlocked and returns
354354
immediately. If an attempt is made to release an unlocked lock, a
355355
:exc:`RuntimeError` will be raised.
356356

357-
Locks also support the :ref:`context manager protocol <with-locks>`.
357+
Locks also support the :ref:`context management protocol <with-locks>`.
358358

359359
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
360360
state to turn to unlocked, only one thread proceeds when a :meth:`~Lock.release`
@@ -433,7 +433,7 @@ call pairs may be nested; only the final :meth:`~Lock.release` (the
433433
:meth:`~Lock.release` of the outermost pair) resets the lock to unlocked and
434434
allows another thread blocked in :meth:`~Lock.acquire` to proceed.
435435

436-
Reentrant locks also support the :ref:`context manager protocol <with-locks>`.
436+
Reentrant locks also support the :ref:`context management protocol <with-locks>`.
437437

438438

439439
.. class:: RLock()
@@ -501,7 +501,7 @@ passed in or one will be created by default. Passing one in is useful when
501501
several condition variables must share the same lock. The lock is part of
502502
the condition object: you don't have to track it separately.
503503

504-
A condition variable obeys the :ref:`context manager protocol <with-locks>`:
504+
A condition variable obeys the :ref:`context management protocol <with-locks>`:
505505
using the ``with`` statement acquires the associated lock for the duration of
506506
the enclosed block. The :meth:`~Condition.acquire` and
507507
:meth:`~Condition.release` methods also call the corresponding methods of
@@ -677,7 +677,7 @@ call. The counter can never go below zero; when :meth:`~Semaphore.acquire`
677677
finds that it is zero, it blocks, waiting until some other thread calls
678678
:meth:`~Semaphore.release`.
679679

680-
Semaphores also support the :ref:`context manager protocol <with-locks>`.
680+
Semaphores also support the :ref:`context management protocol <with-locks>`.
681681

682682

683683
.. class:: Semaphore(value=1)

Doc/whatsnew/2.7.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ changes, or look through the Subversion logs for all the details.
16121612
resulting archive. This is more powerful than the existing
16131613
*exclude* argument, which has therefore been deprecated.
16141614
(Added by Lars Gustäbel; :issue:`6856`.)
1615-
The :class:`~tarfile.TarFile` class also now supports the context manager protocol.
1615+
The :class:`~tarfile.TarFile` class also now supports the context management protocol.
16161616
(Added by Lars Gustäbel; :issue:`7232`.)
16171617

16181618
* The :meth:`~threading.Event.wait` method of the :class:`threading.Event` class

Doc/whatsnew/3.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ New, Improved, and Deprecated Modules
238238
(Contributed by Guilherme Polo; :issue:`2983`.)
239239

240240
* The :class:`gzip.GzipFile` and :class:`bz2.BZ2File` classes now support
241-
the context manager protocol::
241+
the context management protocol::
242242

243243
>>> # Automatically close file after writing
244244
>>> with gzip.GzipFile(filename, "wb") as f:

Doc/whatsnew/3.2.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ Some smaller changes made to the core Python language are:
522522
(Proposed and implemented by Mark Dickinson; :issue:`9337`.)
523523

524524
* :class:`memoryview` objects now have a :meth:`~memoryview.release()` method
525-
and they also now support the context manager protocol. This allows timely
525+
and they also now support the context management protocol. This allows timely
526526
release of any resources that were acquired when requesting a buffer from the
527527
original object.
528528

@@ -1315,7 +1315,7 @@ contexts that correspond to the decimal interchange formats specified in IEEE
13151315
ftp
13161316
---
13171317

1318-
The :class:`ftplib.FTP` class now supports the context manager protocol to
1318+
The :class:`ftplib.FTP` class now supports the context management protocol to
13191319
unconditionally consume :exc:`socket.error` exceptions and to close the FTP
13201320
connection when done::
13211321

@@ -1595,7 +1595,7 @@ The :mod:`socket` module has two new improvements.
15951595
descriptor. The latter can then be reused for other purposes.
15961596
(Added by Antoine Pitrou; :issue:`8524`.)
15971597

1598-
* :func:`socket.create_connection` now supports the context manager protocol
1598+
* :func:`socket.create_connection` now supports the context management protocol
15991599
to unconditionally consume :exc:`socket.error` exceptions and to close the
16001600
socket when done.
16011601
(Contributed by Giampaolo Rodolà; :issue:`9794`.)

Doc/whatsnew/3.3.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ Schlawack in :issue:`12708`.)
15561556
nntplib
15571557
-------
15581558

1559-
The :class:`nntplib.NNTP` class now supports the context manager protocol to
1559+
The :class:`nntplib.NNTP` class now supports the context management protocol to
15601560
unconditionally consume :exc:`socket.error` exceptions and to close the NNTP
15611561
connection when done::
15621562

@@ -1861,7 +1861,7 @@ to specify the ``(host, port)`` to use as the source address in the bind call
18611861
when creating the outgoing socket. (Contributed by Paulo Scardine in
18621862
:issue:`11281`.)
18631863

1864-
:class:`~smtplib.SMTP` now supports the context manager protocol, allowing an
1864+
:class:`~smtplib.SMTP` now supports the context management protocol, allowing an
18651865
``SMTP`` instance to be used in a ``with`` statement. (Contributed
18661866
by Giampaolo Rodolà in :issue:`11289`.)
18671867

Doc/whatsnew/3.4.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ aifc
608608
The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than a
609609
plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)
610610

611-
:func:`aifc.open` now supports the context manager protocol: when used in a
611+
:func:`aifc.open` now supports the context management protocol: when used in a
612612
:keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned
613613
object will be called automatically at the end of the block. (Contributed by
614614
Serhiy Storchacha in :issue:`16486`.)
@@ -1521,7 +1521,7 @@ sunau
15211521
The :meth:`~sunau.getparams` method now returns a namedtuple rather than a
15221522
plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)
15231523

1524-
:meth:`sunau.open` now supports the context manager protocol: when used in a
1524+
:meth:`sunau.open` now supports the context management protocol: when used in a
15251525
:keyword:`with` block, the ``close`` method of the returned object will be
15261526
called automatically at the end of the block. (Contributed by Serhiy Storchaka
15271527
in :issue:`18878`.)
@@ -1723,7 +1723,7 @@ wave
17231723
The :meth:`~wave.getparams` method now returns a namedtuple rather than a
17241724
plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)
17251725

1726-
:meth:`wave.open` now supports the context manager protocol. (Contributed
1726+
:meth:`wave.open` now supports the context management protocol. (Contributed
17271727
by Claudiu Popa in :issue:`17616`.)
17281728

17291729
:mod:`wave` can now :ref:`write output to unseekable files

Lib/asyncio/locks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Lock:
6363
6464
acquire() is a coroutine and should be called with 'yield from'.
6565
66-
Locks also support the context manager protocol. '(yield from lock)'
66+
Locks also support the context management protocol. '(yield from lock)'
6767
should be used as context manager expression.
6868
6969
Usage:
@@ -376,7 +376,7 @@ class Semaphore:
376376
can never go below zero; when acquire() finds that it is zero, it blocks,
377377
waiting until some other thread calls release().
378378
379-
Semaphores also support the context manager protocol.
379+
Semaphores also support the context management protocol.
380380
381381
The optional argument gives the initial value for the internal
382382
counter; it defaults to 1. If the value given is less than 0,

Lib/mailbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ def _read(self, size, read_method):
19801980
return result
19811981

19821982
def __enter__(self):
1983-
"""Context manager protocol support."""
1983+
"""Context management protocol support."""
19841984
return self
19851985

19861986
def __exit__(self, *exc):

Misc/HISTORY

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ Library
811811

812812
- Issue #14772: Return destination values from some shutil functions.
813813

814-
- Issue #15064: Implement context manager protocol for multiprocessing types
814+
- Issue #15064: Implement context management protocol for multiprocessing types
815815

816816
- Issue #15101: Make pool finalizer avoid joining current thread.
817817

@@ -3606,7 +3606,7 @@ Library
36063606
``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a
36073607
TypeError. Patch by Charles-François Natali.
36083608

3609-
- Issue #9795: add context manager protocol support for nntplib.NNTP class.
3609+
- Issue #9795: add context management protocol support for nntplib.NNTP class.
36103610

36113611
- Issue #11306: mailbox in certain cases adapts to an inability to open
36123612
certain files in read-write mode. Previously it detected this by
@@ -4804,7 +4804,7 @@ Library
48044804
- Issue #1486713: HTMLParser now has an optional tolerant mode where it tries to
48054805
guess at the correct parsing of invalid html.
48064806

4807-
- Issue #10554: Add context manager support to subprocess.Popen objects.
4807+
- Issue #10554: Add context management protocol support to subprocess.Popen objects.
48084808

48094809
- Issue #8989: email.utils.make_msgid now has a domain parameter that can
48104810
override the domain name used in the generated msgid.
@@ -5166,7 +5166,7 @@ Library
51665166
- Issue #10253: FileIO leaks a file descriptor when trying to open a file for
51675167
append that isn't seekable. Patch by Brian Brazil.
51685168

5169-
- Support context manager protocol for file-like objects returned by mailbox
5169+
- Support context management protocol for file-like objects returned by mailbox
51705170
``get_file()`` methods.
51715171

51725172
- Issue #10246: uu.encode didn't close file objects explicitly when filenames
@@ -5300,7 +5300,7 @@ Extension Modules
53005300

53015301
- Issue #10143: Update "os.pathconf" values.
53025302

5303-
- Issue #6518: Support context manager protcol for ossaudiodev types.
5303+
- Issue #6518: Support context management protocol for ossaudiodev types.
53045304

53055305
- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
53065306

@@ -5909,7 +5909,7 @@ Extension Modules
59095909

59105910
- Issue #8105: Validate file descriptor passed to mmap.mmap on Windows.
59115911

5912-
- Issue #8046: Add context manager protocol support and .closed property to mmap
5912+
- Issue #8046: Add context management protocol support and .closed property to mmap
59135913
objects.
59145914

59155915
Library
@@ -6916,7 +6916,7 @@ Library
69166916
- The audioop module now supports sound fragments of length greater than 2**31
69176917
bytes on 64-bit machines, and is PY_SSIZE_T_CLEAN.
69186918

6919-
- Issue #4972: Add support for the context manager protocol to the ftplib.FTP
6919+
- Issue #4972: Add support for the context management protocol to the ftplib.FTP
69206920
class.
69216921

69226922
- Issue #8664: In py_compile, create __pycache__ when the compiled path is
@@ -7204,7 +7204,7 @@ Library
72047204
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
72057205
reset also the pointer to the current pointer context.
72067206

7207-
- Issue #7232: Add support for the context manager protocol to the TarFile
7207+
- Issue #7232: Add support for the context management protocol to the TarFile
72087208
class.
72097209

72107210
- Issue #7250: Fix info leak of os.environ across multi-run uses of
@@ -9242,7 +9242,7 @@ Library
92429242
- Issue #1696199: Add collections.Counter() for rapid and convenient
92439243
counting.
92449244

9245-
- Issue #3860: GzipFile and BZ2File now support the context manager protocol.
9245+
- Issue #3860: GzipFile and BZ2File now support the context management protocol.
92469246

92479247
- Issue #4867: Fixed a crash in ctypes when passing a string to a
92489248
function without defining argtypes.

Misc/NEWS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ Library
19581958
- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID,
19591959
NID, short name and long name.
19601960

1961-
- Issue #19282: dbm.open now supports the context manager protocol. (Inital
1961+
- Issue #19282: dbm.open now supports the context management protocol. (Inital
19621962
patch by Claudiu Popa)
19631963

19641964
- Issue #8311: Added support for writing any bytes-like objects in the aifc,
@@ -2667,7 +2667,7 @@ Library
26672667
- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even
26682668
when input list contains duplicates.
26692669

2670-
- Issue #18878: sunau.open now supports the context manager protocol. Based on
2670+
- Issue #18878: sunau.open now supports the context management protocol. Based on
26712671
patches by Claudiu Popa and R. David Murray.
26722672

26732673
- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast
@@ -3307,7 +3307,7 @@ Library
33073307
initialization, so as to reclaim allocated resources (Python callbacks)
33083308
at shutdown. Original patch by Robin Schreiber.
33093309

3310-
- Issue #17616: wave.open now supports the context manager protocol.
3310+
- Issue #17616: wave.open now supports the context management protocol.
33113311

33123312
- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
33133313
'SHA1' instead of 'SHA'.

Modules/ossaudiodev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ static PyMethodDef oss_methods[] = {
894894
/* Aliases for backwards compatibility */
895895
{ "flush", (PyCFunction)oss_sync, METH_VARARGS },
896896

897-
/* Support for the context manager protocol */
897+
/* Support for the context management protocol */
898898
{ "__enter__", oss_self, METH_NOARGS },
899899
{ "__exit__", oss_exit, METH_VARARGS },
900900

@@ -906,7 +906,7 @@ static PyMethodDef oss_mixer_methods[] = {
906906
{ "close", (PyCFunction)oss_mixer_close, METH_NOARGS },
907907
{ "fileno", (PyCFunction)oss_mixer_fileno, METH_NOARGS },
908908

909-
/* Support for the context manager protocol */
909+
/* Support for the context management protocol */
910910
{ "__enter__", oss_self, METH_NOARGS },
911911
{ "__exit__", oss_exit, METH_VARARGS },
912912

0 commit comments

Comments
 (0)