mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Issue #22369: Change "context manager protocol" to "context management protocol".
This commit is contained in:
commit
dd6507eb86
16 changed files with 42 additions and 42 deletions
|
@ -34,7 +34,7 @@ Lock
|
||||||
|
|
||||||
:meth:`acquire` is a coroutine and should be called with ``yield from``.
|
:meth:`acquire` is a coroutine and should be called with ``yield from``.
|
||||||
|
|
||||||
Locks also support the context manager protocol. ``(yield from lock)``
|
Locks also support the context management protocol. ``(yield from lock)``
|
||||||
should be used as context manager expression.
|
should be used as context manager expression.
|
||||||
|
|
||||||
Usage::
|
Usage::
|
||||||
|
@ -229,7 +229,7 @@ Semaphore
|
||||||
counter can never go below zero; when :meth:`acquire` finds that it is zero,
|
counter can never go below zero; when :meth:`acquire` finds that it is zero,
|
||||||
it blocks, waiting until some other thread calls :meth:`release`.
|
it blocks, waiting until some other thread calls :meth:`release`.
|
||||||
|
|
||||||
Semaphores also support the context manager protocol.
|
Semaphores also support the context management protocol.
|
||||||
|
|
||||||
The optional argument gives the initial value for the internal counter; it
|
The optional argument gives the initial value for the internal counter; it
|
||||||
defaults to ``1``. If the value given is less than ``0``, :exc:`ValueError`
|
defaults to ``1``. If the value given is less than ``0``, :exc:`ValueError`
|
||||||
|
|
|
@ -202,7 +202,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
The file object really is a binary file; previously it was incorrectly
|
The file object really is a binary file; previously it was incorrectly
|
||||||
returned in text mode. Also, the file-like object now supports the
|
returned in text mode. Also, the file-like object now supports the
|
||||||
context manager protocol: you can use a :keyword:`with` statement to
|
context management protocol: you can use a :keyword:`with` statement to
|
||||||
automatically close it.
|
automatically close it.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ Connection objects are usually created using :func:`Pipe` -- see also
|
||||||
using :meth:`Connection.send` and :meth:`Connection.recv`.
|
using :meth:`Connection.send` and :meth:`Connection.recv`.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
Connection objects now support the context manager protocol -- see
|
Connection objects now support the context management protocol -- see
|
||||||
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
||||||
connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
|
connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
|
||||||
|
|
||||||
|
@ -1506,7 +1506,7 @@ their parent process exits. The manager classes are defined in the
|
||||||
The address used by the manager.
|
The address used by the manager.
|
||||||
|
|
||||||
.. versionchanged:: 3.3
|
.. versionchanged:: 3.3
|
||||||
Manager objects support the context manager protocol -- see
|
Manager objects support the context management protocol -- see
|
||||||
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the
|
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the
|
||||||
server process (if it has not already started) and then returns the
|
server process (if it has not already started) and then returns the
|
||||||
manager object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`.
|
manager object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`.
|
||||||
|
@ -1998,7 +1998,7 @@ with the :class:`Pool` class.
|
||||||
:meth:`terminate` before using :meth:`join`.
|
:meth:`terminate` before using :meth:`join`.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
Pool objects now support the context manager protocol -- see
|
Pool objects now support the context management protocol -- see
|
||||||
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
||||||
pool object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`.
|
pool object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`.
|
||||||
|
|
||||||
|
@ -2171,7 +2171,7 @@ multiple connections at the same time.
|
||||||
unavailable then it is ``None``.
|
unavailable then it is ``None``.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
Listener objects now support the context manager protocol -- see
|
Listener objects now support the context management protocol -- see
|
||||||
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
:ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the
|
||||||
listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
|
listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`.
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ and (read-only) attributes:
|
||||||
data written is always equal to the amount of data supplied.
|
data written is always equal to the amount of data supplied.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
Audio device objects also support the context manager protocol, i.e. they can
|
Audio device objects also support the context management protocol, i.e. they can
|
||||||
be used in a :keyword:`with` statement.
|
be used in a :keyword:`with` statement.
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ The mixer object provides two file-like methods:
|
||||||
Returns the file handle number of the open mixer device file.
|
Returns the file handle number of the open mixer device file.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
Mixer objects also support the context manager protocol.
|
Mixer objects also support the context management protocol.
|
||||||
|
|
||||||
|
|
||||||
The remaining methods are specific to audio mixing:
|
The remaining methods are specific to audio mixing:
|
||||||
|
|
|
@ -238,7 +238,7 @@ be finalized; only the internally used file object will be closed. See the
|
||||||
:ref:`tar-examples` section for a use case.
|
:ref:`tar-examples` section for a use case.
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
.. versionadded:: 3.2
|
||||||
Added support for the context manager protocol.
|
Added support for the context management protocol.
|
||||||
|
|
||||||
.. 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)
|
.. 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)
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ called in the locked state; it changes the state to unlocked and returns
|
||||||
immediately. If an attempt is made to release an unlocked lock, a
|
immediately. If an attempt is made to release an unlocked lock, a
|
||||||
:exc:`RuntimeError` will be raised.
|
:exc:`RuntimeError` will be raised.
|
||||||
|
|
||||||
Locks also support the :ref:`context manager protocol <with-locks>`.
|
Locks also support the :ref:`context management protocol <with-locks>`.
|
||||||
|
|
||||||
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
|
When more than one thread is blocked in :meth:`~Lock.acquire` waiting for the
|
||||||
state to turn to unlocked, only one thread proceeds when a :meth:`~Lock.release`
|
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
|
||||||
:meth:`~Lock.release` of the outermost pair) resets the lock to unlocked and
|
:meth:`~Lock.release` of the outermost pair) resets the lock to unlocked and
|
||||||
allows another thread blocked in :meth:`~Lock.acquire` to proceed.
|
allows another thread blocked in :meth:`~Lock.acquire` to proceed.
|
||||||
|
|
||||||
Reentrant locks also support the :ref:`context manager protocol <with-locks>`.
|
Reentrant locks also support the :ref:`context management protocol <with-locks>`.
|
||||||
|
|
||||||
|
|
||||||
.. class:: RLock()
|
.. class:: RLock()
|
||||||
|
@ -501,7 +501,7 @@ passed in or one will be created by default. Passing one in is useful when
|
||||||
several condition variables must share the same lock. The lock is part of
|
several condition variables must share the same lock. The lock is part of
|
||||||
the condition object: you don't have to track it separately.
|
the condition object: you don't have to track it separately.
|
||||||
|
|
||||||
A condition variable obeys the :ref:`context manager protocol <with-locks>`:
|
A condition variable obeys the :ref:`context management protocol <with-locks>`:
|
||||||
using the ``with`` statement acquires the associated lock for the duration of
|
using the ``with`` statement acquires the associated lock for the duration of
|
||||||
the enclosed block. The :meth:`~Condition.acquire` and
|
the enclosed block. The :meth:`~Condition.acquire` and
|
||||||
:meth:`~Condition.release` methods also call the corresponding methods of
|
: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`
|
||||||
finds that it is zero, it blocks, waiting until some other thread calls
|
finds that it is zero, it blocks, waiting until some other thread calls
|
||||||
:meth:`~Semaphore.release`.
|
:meth:`~Semaphore.release`.
|
||||||
|
|
||||||
Semaphores also support the :ref:`context manager protocol <with-locks>`.
|
Semaphores also support the :ref:`context management protocol <with-locks>`.
|
||||||
|
|
||||||
|
|
||||||
.. class:: Semaphore(value=1)
|
.. class:: Semaphore(value=1)
|
||||||
|
|
|
@ -1612,7 +1612,7 @@ changes, or look through the Subversion logs for all the details.
|
||||||
resulting archive. This is more powerful than the existing
|
resulting archive. This is more powerful than the existing
|
||||||
*exclude* argument, which has therefore been deprecated.
|
*exclude* argument, which has therefore been deprecated.
|
||||||
(Added by Lars Gustäbel; :issue:`6856`.)
|
(Added by Lars Gustäbel; :issue:`6856`.)
|
||||||
The :class:`~tarfile.TarFile` class also now supports the context manager protocol.
|
The :class:`~tarfile.TarFile` class also now supports the context management protocol.
|
||||||
(Added by Lars Gustäbel; :issue:`7232`.)
|
(Added by Lars Gustäbel; :issue:`7232`.)
|
||||||
|
|
||||||
* The :meth:`~threading.Event.wait` method of the :class:`threading.Event` class
|
* The :meth:`~threading.Event.wait` method of the :class:`threading.Event` class
|
||||||
|
|
|
@ -238,7 +238,7 @@ New, Improved, and Deprecated Modules
|
||||||
(Contributed by Guilherme Polo; :issue:`2983`.)
|
(Contributed by Guilherme Polo; :issue:`2983`.)
|
||||||
|
|
||||||
* The :class:`gzip.GzipFile` and :class:`bz2.BZ2File` classes now support
|
* The :class:`gzip.GzipFile` and :class:`bz2.BZ2File` classes now support
|
||||||
the context manager protocol::
|
the context management protocol::
|
||||||
|
|
||||||
>>> # Automatically close file after writing
|
>>> # Automatically close file after writing
|
||||||
>>> with gzip.GzipFile(filename, "wb") as f:
|
>>> with gzip.GzipFile(filename, "wb") as f:
|
||||||
|
|
|
@ -522,7 +522,7 @@ Some smaller changes made to the core Python language are:
|
||||||
(Proposed and implemented by Mark Dickinson; :issue:`9337`.)
|
(Proposed and implemented by Mark Dickinson; :issue:`9337`.)
|
||||||
|
|
||||||
* :class:`memoryview` objects now have a :meth:`~memoryview.release()` method
|
* :class:`memoryview` objects now have a :meth:`~memoryview.release()` method
|
||||||
and they also now support the context manager protocol. This allows timely
|
and they also now support the context management protocol. This allows timely
|
||||||
release of any resources that were acquired when requesting a buffer from the
|
release of any resources that were acquired when requesting a buffer from the
|
||||||
original object.
|
original object.
|
||||||
|
|
||||||
|
@ -1315,7 +1315,7 @@ contexts that correspond to the decimal interchange formats specified in IEEE
|
||||||
ftp
|
ftp
|
||||||
---
|
---
|
||||||
|
|
||||||
The :class:`ftplib.FTP` class now supports the context manager protocol to
|
The :class:`ftplib.FTP` class now supports the context management protocol to
|
||||||
unconditionally consume :exc:`socket.error` exceptions and to close the FTP
|
unconditionally consume :exc:`socket.error` exceptions and to close the FTP
|
||||||
connection when done::
|
connection when done::
|
||||||
|
|
||||||
|
@ -1595,7 +1595,7 @@ The :mod:`socket` module has two new improvements.
|
||||||
descriptor. The latter can then be reused for other purposes.
|
descriptor. The latter can then be reused for other purposes.
|
||||||
(Added by Antoine Pitrou; :issue:`8524`.)
|
(Added by Antoine Pitrou; :issue:`8524`.)
|
||||||
|
|
||||||
* :func:`socket.create_connection` now supports the context manager protocol
|
* :func:`socket.create_connection` now supports the context management protocol
|
||||||
to unconditionally consume :exc:`socket.error` exceptions and to close the
|
to unconditionally consume :exc:`socket.error` exceptions and to close the
|
||||||
socket when done.
|
socket when done.
|
||||||
(Contributed by Giampaolo Rodolà; :issue:`9794`.)
|
(Contributed by Giampaolo Rodolà; :issue:`9794`.)
|
||||||
|
|
|
@ -1556,7 +1556,7 @@ Schlawack in :issue:`12708`.)
|
||||||
nntplib
|
nntplib
|
||||||
-------
|
-------
|
||||||
|
|
||||||
The :class:`nntplib.NNTP` class now supports the context manager protocol to
|
The :class:`nntplib.NNTP` class now supports the context management protocol to
|
||||||
unconditionally consume :exc:`socket.error` exceptions and to close the NNTP
|
unconditionally consume :exc:`socket.error` exceptions and to close the NNTP
|
||||||
connection when done::
|
connection when done::
|
||||||
|
|
||||||
|
@ -1861,7 +1861,7 @@ to specify the ``(host, port)`` to use as the source address in the bind call
|
||||||
when creating the outgoing socket. (Contributed by Paulo Scardine in
|
when creating the outgoing socket. (Contributed by Paulo Scardine in
|
||||||
:issue:`11281`.)
|
:issue:`11281`.)
|
||||||
|
|
||||||
:class:`~smtplib.SMTP` now supports the context manager protocol, allowing an
|
:class:`~smtplib.SMTP` now supports the context management protocol, allowing an
|
||||||
``SMTP`` instance to be used in a ``with`` statement. (Contributed
|
``SMTP`` instance to be used in a ``with`` statement. (Contributed
|
||||||
by Giampaolo Rodolà in :issue:`11289`.)
|
by Giampaolo Rodolà in :issue:`11289`.)
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ aifc
|
||||||
The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than a
|
The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than a
|
||||||
plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)
|
plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)
|
||||||
|
|
||||||
:func:`aifc.open` now supports the context manager protocol: when used in a
|
:func:`aifc.open` now supports the context management protocol: when used in a
|
||||||
:keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned
|
:keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned
|
||||||
object will be called automatically at the end of the block. (Contributed by
|
object will be called automatically at the end of the block. (Contributed by
|
||||||
Serhiy Storchacha in :issue:`16486`.)
|
Serhiy Storchacha in :issue:`16486`.)
|
||||||
|
@ -1521,7 +1521,7 @@ sunau
|
||||||
The :meth:`~sunau.getparams` method now returns a namedtuple rather than a
|
The :meth:`~sunau.getparams` method now returns a namedtuple rather than a
|
||||||
plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)
|
plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)
|
||||||
|
|
||||||
:meth:`sunau.open` now supports the context manager protocol: when used in a
|
:meth:`sunau.open` now supports the context management protocol: when used in a
|
||||||
:keyword:`with` block, the ``close`` method of the returned object will be
|
:keyword:`with` block, the ``close`` method of the returned object will be
|
||||||
called automatically at the end of the block. (Contributed by Serhiy Storchaka
|
called automatically at the end of the block. (Contributed by Serhiy Storchaka
|
||||||
in :issue:`18878`.)
|
in :issue:`18878`.)
|
||||||
|
@ -1723,7 +1723,7 @@ wave
|
||||||
The :meth:`~wave.getparams` method now returns a namedtuple rather than a
|
The :meth:`~wave.getparams` method now returns a namedtuple rather than a
|
||||||
plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)
|
plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)
|
||||||
|
|
||||||
:meth:`wave.open` now supports the context manager protocol. (Contributed
|
:meth:`wave.open` now supports the context management protocol. (Contributed
|
||||||
by Claudiu Popa in :issue:`17616`.)
|
by Claudiu Popa in :issue:`17616`.)
|
||||||
|
|
||||||
:mod:`wave` can now :ref:`write output to unseekable files
|
:mod:`wave` can now :ref:`write output to unseekable files
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Lock:
|
||||||
|
|
||||||
acquire() is a coroutine and should be called with 'yield from'.
|
acquire() is a coroutine and should be called with 'yield from'.
|
||||||
|
|
||||||
Locks also support the context manager protocol. '(yield from lock)'
|
Locks also support the context management protocol. '(yield from lock)'
|
||||||
should be used as context manager expression.
|
should be used as context manager expression.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
|
@ -376,7 +376,7 @@ class Semaphore:
|
||||||
can never go below zero; when acquire() finds that it is zero, it blocks,
|
can never go below zero; when acquire() finds that it is zero, it blocks,
|
||||||
waiting until some other thread calls release().
|
waiting until some other thread calls release().
|
||||||
|
|
||||||
Semaphores also support the context manager protocol.
|
Semaphores also support the context management protocol.
|
||||||
|
|
||||||
The optional argument gives the initial value for the internal
|
The optional argument gives the initial value for the internal
|
||||||
counter; it defaults to 1. If the value given is less than 0,
|
counter; it defaults to 1. If the value given is less than 0,
|
||||||
|
|
|
@ -1980,7 +1980,7 @@ class _ProxyFile:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""Context manager protocol support."""
|
"""Context management protocol support."""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *exc):
|
def __exit__(self, *exc):
|
||||||
|
|
18
Misc/HISTORY
18
Misc/HISTORY
|
@ -806,7 +806,7 @@ Library
|
||||||
|
|
||||||
- Issue #14772: Return destination values from some shutil functions.
|
- Issue #14772: Return destination values from some shutil functions.
|
||||||
|
|
||||||
- Issue #15064: Implement context manager protocol for multiprocessing types
|
- Issue #15064: Implement context management protocol for multiprocessing types
|
||||||
|
|
||||||
- Issue #15101: Make pool finalizer avoid joining current thread.
|
- Issue #15101: Make pool finalizer avoid joining current thread.
|
||||||
|
|
||||||
|
@ -3527,7 +3527,7 @@ Library
|
||||||
``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a
|
``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a
|
||||||
TypeError. Patch by Charles-François Natali.
|
TypeError. Patch by Charles-François Natali.
|
||||||
|
|
||||||
- Issue #9795: add context manager protocol support for nntplib.NNTP class.
|
- Issue #9795: add context management protocol support for nntplib.NNTP class.
|
||||||
|
|
||||||
- Issue #11306: mailbox in certain cases adapts to an inability to open
|
- Issue #11306: mailbox in certain cases adapts to an inability to open
|
||||||
certain files in read-write mode. Previously it detected this by
|
certain files in read-write mode. Previously it detected this by
|
||||||
|
@ -4837,7 +4837,7 @@ Library
|
||||||
- Issue #1486713: HTMLParser now has an optional tolerant mode where it tries to
|
- Issue #1486713: HTMLParser now has an optional tolerant mode where it tries to
|
||||||
guess at the correct parsing of invalid html.
|
guess at the correct parsing of invalid html.
|
||||||
|
|
||||||
- Issue #10554: Add context manager support to subprocess.Popen objects.
|
- Issue #10554: Add context management protocol support to subprocess.Popen objects.
|
||||||
|
|
||||||
- Issue #8989: email.utils.make_msgid now has a domain parameter that can
|
- Issue #8989: email.utils.make_msgid now has a domain parameter that can
|
||||||
override the domain name used in the generated msgid.
|
override the domain name used in the generated msgid.
|
||||||
|
@ -5199,7 +5199,7 @@ Library
|
||||||
- Issue #10253: FileIO leaks a file descriptor when trying to open a file for
|
- Issue #10253: FileIO leaks a file descriptor when trying to open a file for
|
||||||
append that isn't seekable. Patch by Brian Brazil.
|
append that isn't seekable. Patch by Brian Brazil.
|
||||||
|
|
||||||
- Support context manager protocol for file-like objects returned by mailbox
|
- Support context management protocol for file-like objects returned by mailbox
|
||||||
``get_file()`` methods.
|
``get_file()`` methods.
|
||||||
|
|
||||||
- Issue #10246: uu.encode didn't close file objects explicitly when filenames
|
- Issue #10246: uu.encode didn't close file objects explicitly when filenames
|
||||||
|
@ -5333,7 +5333,7 @@ Extension Modules
|
||||||
|
|
||||||
- Issue #10143: Update "os.pathconf" values.
|
- Issue #10143: Update "os.pathconf" values.
|
||||||
|
|
||||||
- Issue #6518: Support context manager protcol for ossaudiodev types.
|
- Issue #6518: Support context management protocol for ossaudiodev types.
|
||||||
|
|
||||||
- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
|
- Issue #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.
|
||||||
|
|
||||||
|
@ -5942,7 +5942,7 @@ Extension Modules
|
||||||
|
|
||||||
- Issue #8105: Validate file descriptor passed to mmap.mmap on Windows.
|
- Issue #8105: Validate file descriptor passed to mmap.mmap on Windows.
|
||||||
|
|
||||||
- Issue #8046: Add context manager protocol support and .closed property to mmap
|
- Issue #8046: Add context management protocol support and .closed property to mmap
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
|
@ -6949,7 +6949,7 @@ Library
|
||||||
- The audioop module now supports sound fragments of length greater than 2**31
|
- The audioop module now supports sound fragments of length greater than 2**31
|
||||||
bytes on 64-bit machines, and is PY_SSIZE_T_CLEAN.
|
bytes on 64-bit machines, and is PY_SSIZE_T_CLEAN.
|
||||||
|
|
||||||
- Issue #4972: Add support for the context manager protocol to the ftplib.FTP
|
- Issue #4972: Add support for the context management protocol to the ftplib.FTP
|
||||||
class.
|
class.
|
||||||
|
|
||||||
- Issue #8664: In py_compile, create __pycache__ when the compiled path is
|
- Issue #8664: In py_compile, create __pycache__ when the compiled path is
|
||||||
|
@ -7237,7 +7237,7 @@ Library
|
||||||
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
|
- Issue #7494: fix a crash in _lsprof (cProfile) after clearing the profiler,
|
||||||
reset also the pointer to the current pointer context.
|
reset also the pointer to the current pointer context.
|
||||||
|
|
||||||
- Issue #7232: Add support for the context manager protocol to the TarFile
|
- Issue #7232: Add support for the context management protocol to the TarFile
|
||||||
class.
|
class.
|
||||||
|
|
||||||
- Issue #7250: Fix info leak of os.environ across multi-run uses of
|
- Issue #7250: Fix info leak of os.environ across multi-run uses of
|
||||||
|
@ -9275,7 +9275,7 @@ Library
|
||||||
- Issue #1696199: Add collections.Counter() for rapid and convenient
|
- Issue #1696199: Add collections.Counter() for rapid and convenient
|
||||||
counting.
|
counting.
|
||||||
|
|
||||||
- Issue #3860: GzipFile and BZ2File now support the context manager protocol.
|
- Issue #3860: GzipFile and BZ2File now support the context management protocol.
|
||||||
|
|
||||||
- Issue #4867: Fixed a crash in ctypes when passing a string to a
|
- Issue #4867: Fixed a crash in ctypes when passing a string to a
|
||||||
function without defining argtypes.
|
function without defining argtypes.
|
||||||
|
|
|
@ -132,7 +132,7 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
- Issue #12410: imaplib.IMAP4 now supports the context manager protocol.
|
- Issue #12410: imaplib.IMAP4 now supports the context management protocol.
|
||||||
Original patch by Tarek Ziadé.
|
Original patch by Tarek Ziadé.
|
||||||
|
|
||||||
- Issue #16662: load_tests() is now unconditionally run when it is present in
|
- Issue #16662: load_tests() is now unconditionally run when it is present in
|
||||||
|
@ -2286,7 +2286,7 @@ Library
|
||||||
- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID,
|
- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID,
|
||||||
NID, short name and long name.
|
NID, short name and long name.
|
||||||
|
|
||||||
- Issue #19282: dbm.open now supports the context manager protocol. (Inital
|
- Issue #19282: dbm.open now supports the context management protocol. (Inital
|
||||||
patch by Claudiu Popa)
|
patch by Claudiu Popa)
|
||||||
|
|
||||||
- Issue #8311: Added support for writing any bytes-like objects in the aifc,
|
- Issue #8311: Added support for writing any bytes-like objects in the aifc,
|
||||||
|
@ -2995,7 +2995,7 @@ Library
|
||||||
- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even
|
- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even
|
||||||
when input list contains duplicates.
|
when input list contains duplicates.
|
||||||
|
|
||||||
- Issue #18878: sunau.open now supports the context manager protocol. Based on
|
- Issue #18878: sunau.open now supports the context management protocol. Based on
|
||||||
patches by Claudiu Popa and R. David Murray.
|
patches by Claudiu Popa and R. David Murray.
|
||||||
|
|
||||||
- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast
|
- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast
|
||||||
|
@ -3635,7 +3635,7 @@ Library
|
||||||
initialization, so as to reclaim allocated resources (Python callbacks)
|
initialization, so as to reclaim allocated resources (Python callbacks)
|
||||||
at shutdown. Original patch by Robin Schreiber.
|
at shutdown. Original patch by Robin Schreiber.
|
||||||
|
|
||||||
- Issue #17616: wave.open now supports the context manager protocol.
|
- Issue #17616: wave.open now supports the context management protocol.
|
||||||
|
|
||||||
- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
|
- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns
|
||||||
'SHA1' instead of 'SHA'.
|
'SHA1' instead of 'SHA'.
|
||||||
|
|
|
@ -894,7 +894,7 @@ static PyMethodDef oss_methods[] = {
|
||||||
/* Aliases for backwards compatibility */
|
/* Aliases for backwards compatibility */
|
||||||
{ "flush", (PyCFunction)oss_sync, METH_VARARGS },
|
{ "flush", (PyCFunction)oss_sync, METH_VARARGS },
|
||||||
|
|
||||||
/* Support for the context manager protocol */
|
/* Support for the context management protocol */
|
||||||
{ "__enter__", oss_self, METH_NOARGS },
|
{ "__enter__", oss_self, METH_NOARGS },
|
||||||
{ "__exit__", oss_exit, METH_VARARGS },
|
{ "__exit__", oss_exit, METH_VARARGS },
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ static PyMethodDef oss_mixer_methods[] = {
|
||||||
{ "close", (PyCFunction)oss_mixer_close, METH_NOARGS },
|
{ "close", (PyCFunction)oss_mixer_close, METH_NOARGS },
|
||||||
{ "fileno", (PyCFunction)oss_mixer_fileno, METH_NOARGS },
|
{ "fileno", (PyCFunction)oss_mixer_fileno, METH_NOARGS },
|
||||||
|
|
||||||
/* Support for the context manager protocol */
|
/* Support for the context management protocol */
|
||||||
{ "__enter__", oss_self, METH_NOARGS },
|
{ "__enter__", oss_self, METH_NOARGS },
|
||||||
{ "__exit__", oss_exit, METH_VARARGS },
|
{ "__exit__", oss_exit, METH_VARARGS },
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue