Skip to content

Commit

Permalink
Docs: Add deprecation of Image.__del__ (#3929)
Browse files Browse the repository at this point in the history
Docs: Add deprecation of Image.__del__
  • Loading branch information
hugovk committed Jul 1, 2019
2 parents f2b9e88 + c153836 commit 7855a6f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/deprecations.rst
Expand Up @@ -12,6 +12,29 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate,
a ``DeprecationWarning`` is issued.

Image.__del__
~~~~~~~~~~~~~

.. deprecated:: 6.1.0

Implicitly closing the image's underlying file in ``Image.__del__`` has been deprecated.
Use a context manager or call ``Image.close()`` instead to close the file in a
deterministic way.

Deprecated:

.. code-block:: python
im = Image.open("hopper.png")
im.save("out.jpg")
Use instead:

.. code-block:: python
with Image.open("hopper.png") as im:
im.save("out.jpg")
Python 2.7
~~~~~~~~~~

Expand Down
26 changes: 26 additions & 0 deletions docs/releasenotes/6.1.0.rst
@@ -1,6 +1,32 @@
6.1.0
-----

Deprecations
============

Image.__del__
^^^^^^^^^^^^^

.. deprecated:: 6.1.0

Implicitly closing the image's underlying file in ``Image.__del__`` has been deprecated.
Use a context manager or call ``Image.close()`` instead to close the file in a
deterministic way.

Deprecated:

.. code-block:: python
im = Image.open("hopper.png")
im.save("out.jpg")
Use instead:

.. code-block:: python
with Image.open("hopper.png") as im:
im.save("out.jpg")
API Additions
=============

Expand Down

0 comments on commit 7855a6f

Please sign in to comment.