mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-02 23:13:40 +03:00
Docs: Add deprecation of Image.__del__ (#3929)
Docs: Add deprecation of Image.__del__
This commit is contained in:
commit
7855a6fc2f
|
@ -12,6 +12,29 @@ Deprecated features
|
||||||
Below are features which are considered deprecated. Where appropriate,
|
Below are features which are considered deprecated. Where appropriate,
|
||||||
a ``DeprecationWarning`` is issued.
|
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
|
Python 2.7
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
6.1.0
|
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
|
API Additions
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user