Commit Graph

156 Commits

Author SHA1 Message Date
Andrew Murray
68719fe6ea
Merge branch 'master' into exif 2021-03-15 12:41:45 +11:00
Andrew Murray
690cf9ebe2 Allow alpha_composite destination to be negative 2021-03-06 20:54:21 +11:00
Andrew Murray
e763f8f2be Save interop IFD when converting Exif to bytes 2021-02-22 07:47:59 +11:00
Andrew Murray
4b14f0102d Save base IFDs when converting Exif to bytes 2021-02-22 07:47:05 +11:00
Andrew Murray
faf8fad76d Stopped flattening EXIF IFD into getexif() 2021-02-22 07:47:05 +11:00
Andrew Murray
3495b319bd Replaced various instances of assert_image_similar with assert_image_similar_tofile 2021-02-21 22:22:29 +11:00
Andrew Murray
a5c251029c Replaced various instances of assert_image_equal with assert_image_equal_tofile 2021-02-21 22:15:56 +11:00
Hugo van Kemenade
1857bf5570
Merge pull request #5259 from radarhere/warns 2021-02-17 21:31:15 +02:00
Andrew Murray
83542c42bf Added context managers 2021-02-11 21:43:54 +11:00
Andrew Murray
4a0569e97f Changed zero length assertions to falsy 2021-02-11 13:48:31 +11:00
Andrew Murray
01be700081 Fixed asserting that no warnings were raised 2021-02-10 23:37:55 +11:00
Piolie
4a9a999dbb
Update Tests/test_image.py
Keep the original test cases; add the most likely non-uppercase versions.

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
2021-02-05 12:21:27 -03:00
Piolie
0c1675a143 Make formats parameter in Image.open accept aNy cAsE 2021-02-04 22:47:53 -03:00
Eric Soroos
1d7c8e03d0 known failing tests from valgrind -- uninitialized values 2021-01-07 14:52:02 +01:00
Andrew Murray
903c67353d Lint fix 2021-01-02 20:41:17 +11:00
Eric Soroos
2f409261eb Fix for CVE CVE-2020-35655 - Read Overflow in PCX Decoding.
* Don't trust the image to specify a buffer size
2021-01-02 20:38:46 +11:00
Hugo van Kemenade
309cb9e5c4
Merge pull request #4927 from radarhere/tuple 2020-10-12 14:40:22 +03:00
Andrew Murray
7a1f0f6a8f Fixed bug in Exif __delitem__ 2020-10-05 09:45:05 +11:00
Andrew Murray
27c0747518 Allow tuples with one item to give single color value in getink 2020-09-20 14:23:05 +10:00
Andrew Murray
c83ffc6aea Fixed effect_spread bug for zero distance 2020-09-08 18:51:58 +10:00
nulano
a340dc5fd3 Merge remote-tracking branch 'upstream/master' into formats 2020-09-04 21:07:34 +02:00
Andrew Murray
298b7d0333 Update pre-commit 2020-08-31 18:50:15 +10:00
Hugo van Kemenade
dd87dd50c0 Update to isort 5 with Black profile support 2020-08-08 22:39:29 +03:00
nulano
2b061b68db add formats parameter to Image.open to restrict list of formats attempting to read an image file 2020-08-03 00:24:02 +02:00
Hugo van Kemenade
40aefc6ba5 Remove im.offset, deprecated in 2001; and fromstring and tostring, deprecated in 2013 2020-07-17 10:55:20 +03:00
Andrew Murray
9432bba6d1 Moved tests 2020-07-02 20:28:00 +10:00
Andrew Murray
ee06255ff0 Deprecated _showxv 2020-06-23 22:20:58 +10:00
nulano
66954ad176 deprecate Image.show(command="...") 2020-05-25 18:57:02 +02:00
Hugo
dda6145fce Since Python 3.3 IOError and WindowsError have been merged into OSError 2020-04-10 12:57:29 +03:00
Hugo
ada137eba5 Fix Flake8 2020-04-01 10:52:21 +03:00
Eric Soroos
124f4bb591 Tests for PCX OOB Access 2020-04-01 10:50:48 +03:00
Andrew Murray
750bbc7256 Parametrized test 2020-03-31 17:41:52 +11:00
Andrew Murray
7597a9fbfd Raise warning for more operations 2020-03-31 17:41:47 +11:00
Andrew Murray
027d180eda Raise a DeprecationWarning when comparing PILLOW_VERSION 2020-03-30 21:53:02 +11:00
Hugo
44e661f25a Convert to use pytest 2020-02-22 23:03:01 +02:00
Andrew Murray
8482919a37 Converted most assert statements to pytest 2020-02-23 00:06:21 +11:00
Jon Dufresne
98a2081a78 Move safe imports to the top of test files
These modules are safe to import and this better follows PEP 8.

From https://www.python.org/dev/peps/pep-0008/#imports

> Imports are always put at the top of the file, just after any module
> comments and docstrings, and before module globals and constants.
2020-02-17 10:49:27 -08:00
Hugo
38bf862185 Replace PillowTestCase.assert_warning with pytest.warns 2020-02-03 11:11:32 +02:00
Hugo
a4bf9fa036 Convert most PillowTestCase methods to pytest 2020-02-02 12:26:01 +02:00
Andrew Murray
be44f0d992 Catch SGI buffer overruns 2020-01-02 15:24:36 +11:00
Andrew Murray
8f0c8f7311 Catch PCX P mode buffer overrun 2020-01-02 15:24:16 +11:00
Andrew Murray
c40bc25847 Catch FLI buffer overrun 2020-01-02 15:23:36 +11:00
Andrew Murray
fedb0407b4 Raise ValueError for io.StringIO in Image.open 2019-12-26 18:53:06 +11:00
Andrew Murray
c0048ad7de Use context managers 2019-11-26 07:03:23 +11:00
Jon Dufresne
33dabf986f Import unittest from stdlib rather than helper.py
The unittest in helper.py has not offered an interesting abstraction
since dbe9f85c7d so import from the more
typical stdlib location.
2019-11-20 18:42:52 -08:00
Hugo van Kemenade
a949d7882e
Merge branch 'master' into rm-2.7 2019-11-20 10:26:55 +02:00
Andrew Murray
40f891dfd7 Added UnidentifiedImageError 2019-11-19 21:20:02 +11:00
Hugo
cc63f66575 Merge remote-tracking branch 'upstream/master' into rm-2.7 2019-11-01 13:22:56 +02:00
Jon Dufresne
4cd4adddc3 Improve handling of file resources
Follow Python's file object semantics. User code is responsible for
closing resources (usually through a context manager) in a deterministic
way.

To achieve this, remove __del__ functions. These functions used to
closed open file handlers in an attempt to silence Python
ResourceWarnings. However, using __del__ has the following drawbacks:

- __del__ isn't called until the object's reference count reaches 0.
  Therefore, resource handlers remain open or in use longer than
  necessary.

- The __del__ method isn't guaranteed to execute on system exit. See the
  Python documentation:

  https://docs.python.org/3/reference/datamodel.html#object.__del__

  > It is not guaranteed that __del__() methods are called for objects
  > that still exist when the interpreter exits.

- Exceptions that occur inside __del__ are ignored instead of raised.
  This has the potential of hiding bugs. This is also in the Python
  documentation:

  > Warning: Due to the precarious circumstances under which __del__()
  > methods are invoked, exceptions that occur during their execution
  > are ignored, and a warning is printed to sys.stderr instead.

Instead, always close resource handlers when they are no longer in use.
This will close the file handler at a specified point in the user's code
and not wait until the interpreter chooses to. It is always guaranteed
to run. And, if an exception occurs while closing the file handler, the
bug will not be ignored.

Now, when code receives a ResourceWarning, it will highlight an area
that is mishandling resources. It should not simply be silenced, but
fixed by closing resources with a context manager.

All warnings that were emitted during tests have been cleaned up. To
enable warnings, I passed the `-Wa` CLI option to Python. This exposed
some mishandling of resources in ImageFile.__init__() and
SpiderImagePlugin.loadImageSeries(), they too were fixed.
2019-10-12 08:27:17 -07:00
Andrew Murray
4140cd807b
Merge branch 'master' into rm-2.7 2019-10-12 18:03:58 +11:00