Skip to content
Permalink
Browse files

Merge branch 'master' into warn-close

  • Loading branch information...
radarhere committed Mar 3, 2019
2 parents 63e43d6 + 0e9e3dd commit 6464c14bb0cc1d4d90b28512b5dd91a869e5ba88
@@ -5,6 +5,39 @@ Changelog (Pillow)
6.0.0 (unreleased)
------------------

- Python 2.7 support will be removed in Pillow 7.0.0 #3682
[hugovk]

- Removed deprecated VERSION #3624
[hugovk]

- Fix 'BytesWarning: Comparison between bytes and string' in PdfDict #3580
[jdufresne]

- Do not resize in Image.thumbnail if already the destination size #3632
[radarhere]

- Replace .seek() magic numbers with io.SEEK_* constants #3572
[jdufresne]

- Make ContainerIO.isatty() return a bool, not int #3568
[jdufresne]

- Add support for I;16 modes for more transpose operations #3563
[radarhere]

- Deprecate support for PyQt4 and PySide #3655
[hugovk, radarhere]

- Add TIFF compression codecs: LZMA, Zstd, WebP #3555
[cgohlke]

- Fixed pickling of iTXt class with protocol > 1 #3537
[radarhere]

- _util.isPath returns True for pathlib.Path objects #3616
[wbadart]

- Remove unnecessary unittest.main() boilerplate from test files #3631
[jdufresne]

@@ -88,14 +88,7 @@ Released as needed privately to individual vendors for critical security-related
```bash
git clone https://github.com/python-pillow/pillow-wheels
cd pillow-wheels
git submodule init
git submodule update Pillow
cd Pillow
git fetch --all
git checkout [[release tag]]
cd ..
git commit -m "Pillow -> 5.2.0" Pillow
git push
./update-pillow-tag.sh [[release tag]]
```
* [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/).
```bash
Binary file not shown.
@@ -11,8 +11,6 @@ def test_sanity(self):
# Make sure we have the binary extension
PIL.Image.core.new("L", (100, 100))

self.assertEqual(PIL.Image.VERSION[:3], '1.1')

# Create an image and do stuff with it.
im = PIL.Image.new("1", (100, 100))
self.assertEqual((im.mode, im.size), ('1', (100, 100)))
@@ -16,7 +16,7 @@ def test_isatty(self):
with hopper() as im:
container = ContainerIO.ContainerIO(im, 0, 0)

self.assertEqual(container.isatty(), 0)
self.assertFalse(container.isatty())

def test_seek_mode_0(self):
# Arrange
@@ -12,11 +12,11 @@
class TestFileMsp(PillowTestCase):

def test_sanity(self):
file = self.tempfile("temp.msp")
test_file = self.tempfile("temp.msp")

hopper("1").save(file)
hopper("1").save(test_file)

im = Image.open(file)
im = Image.open(test_file)
im.load()
self.assertEqual(im.mode, "1")
self.assertEqual(im.size, (128, 128))
@@ -1,4 +1,5 @@
from .helper import PillowTestCase, hopper
from PIL import Image


class TestImageThumbnail(PillowTestCase):
@@ -35,3 +36,14 @@ def test_aspect(self):
im = hopper().resize((128, 128))
im.thumbnail((100, 100))
self.assert_image(im, im.mode, (100, 100))

def test_no_resize(self):
# Check that draft() can resize the image to the destination size
im = Image.open("Tests/images/hopper.jpg")
im.draft(None, (64, 64))
self.assertEqual(im.size, (64, 64))

# Test thumbnail(), where only draft() is necessary to resize the image
im = Image.open("Tests/images/hopper.jpg")
im.thumbnail((64, 64))
self.assert_image(im, im.mode, (64, 64))
@@ -7,10 +7,9 @@

class TestImageTranspose(PillowTestCase):

hopper = {
'L': helper.hopper('L').crop((0, 0, 121, 127)).copy(),
'RGB': helper.hopper('RGB').crop((0, 0, 121, 127)).copy(),
}
hopper = {mode: helper.hopper(mode).crop((0, 0, 121, 127)).copy() for mode in [
'L', 'RGB', 'I;16', 'I;16L', 'I;16B'
]}

def test_flip_left_right(self):
def transpose(mode):
@@ -25,7 +24,7 @@ def transpose(mode):
self.assertEqual(im.getpixel((1, y-2)), out.getpixel((x-2, y-2)))
self.assertEqual(im.getpixel((x-2, y-2)), out.getpixel((1, y-2)))

for mode in ("L", "RGB"):
for mode in ("L", "RGB", "I;16", "I;16L", "I;16B"):
transpose(mode)

def test_flip_top_bottom(self):
@@ -41,7 +40,7 @@ def transpose(mode):
self.assertEqual(im.getpixel((1, y-2)), out.getpixel((1, 1)))
self.assertEqual(im.getpixel((x-2, y-2)), out.getpixel((x-2, 1)))

for mode in ("L", "RGB"):
for mode in ("L", "RGB", "I;16", "I;16L", "I;16B"):
transpose(mode)

def test_rotate_90(self):
@@ -73,7 +72,7 @@ def transpose(mode):
self.assertEqual(im.getpixel((1, y-2)), out.getpixel((x-2, 1)))
self.assertEqual(im.getpixel((x-2, y-2)), out.getpixel((1, 1)))

for mode in ("L", "RGB"):
for mode in ("L", "RGB", "I;16", "I;16L", "I;16B"):
transpose(mode)

def test_rotate_270(self):
@@ -1,7 +1,16 @@
from .helper import PillowTestCase, hopper

from PIL import ImageQt

import warnings

deprecated = False
with warnings.catch_warnings():
warnings.filterwarnings("error", category=DeprecationWarning)
try:
from PIL import ImageQt
except DeprecationWarning:
deprecated = True
warnings.filterwarnings("ignore", category=DeprecationWarning)
from PIL import ImageQt

if ImageQt.qt_is_installed:
from PIL.ImageQt import qRgba
@@ -78,3 +87,6 @@ def checkrgb(r, g, b):
def test_image(self):
for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
ImageQt.ImageQt(hopper(mode))

def test_deprecated(self):
self.assertEqual(ImageQt.qt_version in ["4", "side"], deprecated)
@@ -67,9 +67,13 @@ def test_pickle_p_mode(self):
"Tests/images/non_zero_bb.png",
"Tests/images/non_zero_bb_scale2.png",
"Tests/images/p_trns_single.png",
"Tests/images/pil123p.png"
"Tests/images/pil123p.png",
"Tests/images/itxt_chunks.png"
]:
self.helper_pickle_string(pickle, test_file=test_file)
for protocol in range(0, pickle.HIGHEST_PROTOCOL + 1):
self.helper_pickle_string(pickle,
protocol=protocol,
test_file=test_file)

def test_pickle_l_mode(self):
# Arrange
@@ -1,4 +1,4 @@
from .helper import PillowTestCase
from .helper import unittest, PillowTestCase

from PIL import _util

@@ -35,6 +35,18 @@ def test_is_path(self):
# Assert
self.assertTrue(it_is)

@unittest.skipIf(not _util.py36, 'os.path support for Paths added in 3.6')
def test_path_obj_is_path(self):
# Arrange
from pathlib import Path
test_path = Path('filename.ext')

# Act
it_is = _util.isPath(test_path)

# Assert
self.assertTrue(it_is)

def test_is_not_path(self):
# Arrange
filename = self.tempfile("temp.ext")
@@ -12,6 +12,27 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate,
a ``DeprecationWarning`` is issued.

Python 2.7
~~~~~~~~~~

.. deprecated:: 6.0.0

Python 2.7 reaches end-of-life on 2020-01-01.

Pillow 7.0.0 will be released on 2020-01-01 and will drop support for Python 2.7, making
Pillow 6.x the last series to support Python 2.

PyQt4 and PySide
~~~~~~~~~~~~~~~~

.. deprecated:: 6.0.0

Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
2018-08-31 and PySide since 2015-10-14.

Support for PyQt4 and PySide has been deprecated from ``ImageQt`` and will be removed in
a future version. Please upgrade to PyQt5 or PySide2.

PIL.*ImagePlugin.__version__ attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -50,13 +71,12 @@ a ``DeprecationWarning``:
Setting the size of a TIFF image directly is deprecated, and will
be removed in a future version. Use the resize method instead.

PILLOW_VERSION and VERSION constants
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PILLOW_VERSION constant
~~~~~~~~~~~~~~~~~~~~~~~

.. deprecated:: 5.2.0

Two version constants – ``VERSION`` (the old PIL version, always 1.1.7) and
``PILLOW_VERSION`` – have been deprecated and will be removed in the next
``PILLOW_VERSION`` has been deprecated and will be removed in the next
major release. Use ``__version__`` instead.

Removed features
@@ -65,6 +85,14 @@ Removed features
Deprecated features are only removed in major releases after an appropriate
period of deprecation has passed.

VERSION constant
~~~~~~~~~~~~~~~~

*Removed in version 6.0.0.*

``VERSION`` (the old PIL version, always 1.1.7) has been removed. Use
``__version__`` instead.

Undocumented ImageOps functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@@ -15,21 +15,23 @@ Notes

.. note:: Pillow is supported on the following Python versions

+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|**Python** |**2.4**|**2.5**|**2.6**|**2.7**|**3.2**|**3.3**|**3.4**|**3.5**|**3.6**|**3.7**|
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow < 2.0.0 | Yes | Yes | Yes | Yes | | | | | | |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 2.x - 3.x | | | Yes | Yes | Yes | Yes | Yes | Yes | | |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 4.x | | | | Yes | | Yes | Yes | Yes | Yes | |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 5.0.x - 5.1.x| | | | Yes | | | Yes | Yes | Yes | |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 5.2.x - 5.4.x| | | | Yes | | | Yes | Yes | Yes | Yes |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow >= 6.0.0 | | | | Yes | | | | Yes | Yes | Yes |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|**Python** |**2.4**|**2.5**|**2.6**|**2.7**|**3.2**|**3.3**|**3.4**|**3.5**|**3.6**|**3.7**|
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow < 2.0.0 | Yes | Yes | Yes | Yes | | | | | | |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 2.x - 3.x | | | Yes | Yes | Yes | Yes | Yes | Yes | | |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 4.x | | | | Yes | | Yes | Yes | Yes | Yes | |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 5.0.x - 5.1.x | | | | Yes | | | Yes | Yes | Yes | |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 5.2.x - 5.4.x | | | | Yes | | | Yes | Yes | Yes | Yes |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 6.x | | | | Yes | | | | Yes | Yes | Yes |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow >= 7.0.0 | | | | | | | | Yes | Yes | Yes |
+---------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+

Basic Installation
------------------
@@ -7,6 +7,12 @@
The :py:mod:`ImageQt` module contains support for creating PyQt4, PyQt5, PySide or
PySide2 QImage objects from PIL images.

Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
2018-08-31 and PySide since 2015-10-14.

Support for PyQt4 and PySide is deprecated since Pillow 6.0.0 and will be removed in a
future version. Please upgrade to PyQt5 or PySide2.

.. versionadded:: 1.1.6

.. py:class:: ImageQt.ImageQt(image)
@@ -26,12 +26,38 @@ Several undocumented functions in ``ImageOps`` were deprecated in Pillow 4.3.0 (
and have now been removed: ``gaussian_blur``, ``gblur``, ``unsharp_mask``, ``usm`` and
``box_blur``. Use the equivalent operations in ``ImageFilter`` instead.

Removed deprecated VERSION
^^^^^^^^^^^^^^^^^^^^^^^^^^

``VERSION`` (the old PIL version, always 1.1.7) has been removed. Use ``__version__``
instead.

API Changes
===========

Deprecations
^^^^^^^^^^^^

Python 2.7
~~~~~~~~~~

Python 2.7 reaches end-of-life on 2020-01-01.

Pillow 7.0.0 will be released on 2020-01-01 and will drop support for Python 2.7, making
Pillow 6.x the last series to support Python 2.

PyQt4 and PySide
~~~~~~~~~~~~~~~~

Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
2018-08-31 and PySide since 2015-10-14.

Support for PyQt4 and PySide has been deprecated from ``ImageQt`` and will be removed in
a future version. Please upgrade to PyQt5 or PySide2.

PIL.*ImagePlugin.__version__ attributes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These version constants have been deprecated and will be removed in a future
version.

@@ -18,6 +18,8 @@
# A file object that provides read access to a part of an existing
# file (for example a TAR file).

import io


class ContainerIO(object):

@@ -39,9 +41,9 @@ def __init__(self, file, offset, length):
# Always false.

def isatty(self):
return 0
return False

def seek(self, offset, mode=0):
def seek(self, offset, mode=io.SEEK_SET):
"""
Move file pointer.

0 comments on commit 6464c14

Please sign in to comment.
You can’t perform that action at this time.