Commit Graph

39 Commits

Author SHA1 Message Date
Andrew Murray
fb7edfda68 Improved consistency of returning an image access object from load() 2022-02-02 11:49:31 +11:00
Andrew Murray
1d73a483f4 Added "transparency" argument to load() 2021-07-19 09:08:45 +10:00
Andrew Murray
ce3d69baf9 Simplified code by writing bytes instead of using wrapping to write strings 2021-04-29 21:35:57 +10:00
Eric Soroos
5a5e6db0ab Fix EPS DOS on _open -- CVE-2021-28677
* The readline used in EPS has to deal with any combination of \r and
  \n as line endings. It used an accidentally quadratic method of
  accumulating lines while looking for a line ending.
* A malicious EPS file could use this to perform a DOS of Pillow in
  the open phase, before an image was accepted for opening.
* This dates to the PIL Fork
2021-04-01 17:17:18 +03:00
Alexander
1ff61bcaa6 use offset for all binary input functions instead of slicing 2020-12-30 19:10:50 +11:00
Hugo van Kemenade
10615a7da7 Upgrade Python syntax for 3.6+
Co-authored-by: nulano <nulano@nulano.eu>
2020-07-30 10:09:18 +03:00
Hugo van Kemenade
384523fab2 Fix PostScript typos 2020-07-10 11:48:02 +03:00
Ram Rachum
2f0d430807 Fix exception causes all over the codebase 2020-06-21 13:21:25 +03:00
Andrew Murray
dd8b0de666 Close excusively opened images 2020-02-18 20:49:05 +11:00
Jon Dufresne
63729766c4 Remove unnecessary coerce to float
In Python 3, the division operator is floating point division. No longer
need to coerce integers to floating point numbers before division.
2020-01-26 06:33:18 -08:00
Hugo
e5486b40f8 Merge remote-tracking branch 'upstream/master' into rm-2.7 2019-11-18 13:56:42 +02:00
Hugo
0c5895470c Remove deprecated __version__ from plugins 2019-11-05 17:01:03 +02:00
Hugo
84e53e3757 Simplify using subprocess.DEVNULL
Co-Authored-By: Jon Dufresne <jon.dufresne@gmail.com>
2019-10-08 17:25:42 +03:00
Andrew Murray
6cd99fc3cf
Merge branch 'master' into rm-2.7 2019-10-08 18:57:27 +11:00
Jon Dufresne
64032061c0 Move several imports to the top-level of the file
This better follows PEP 8 style guide:

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.

This also avoids duplicate import code within the same file.
2019-10-07 06:28:36 -07:00
Hugo
538d9e2e5d Upgrade Python syntax with pyupgrade --py3-plus 2019-10-07 14:30:59 +03:00
Hugo
af770a6c55 Drop support for EOL Python 2.7 2019-10-07 14:30:59 +03:00
Jon Dufresne
d50445ff30 Introduce isort to automate import ordering and formatting
Similar to the recent adoption of Black. isort is a Python utility to
sort imports alphabetically and automatically separate into sections. By
using isort, contributors can quickly and automatically conform to the
projects style without thinking. Just let the tool do it.

Uses the configuration recommended by the Black to avoid conflicts of
style.

Rewrite TestImageQt.test_deprecated to no rely on import order.
2019-07-06 16:11:35 -07:00
Hugo
53a7e35004 Format with Black 2019-06-10 18:22:46 +03:00
Hugo
77d1c609f3
Merge pull request #3635 from radarhere/eps
Changed EPS subprocess stdout from devnull to None
2019-03-11 21:15:18 +02:00
Hugo
b75210d824
Merge pull request #3572 from jdufresne/seek-constants
Replace .seek() magic numbers with io.SEEK_* constants
2019-02-27 23:30:27 +02:00
Hugo
f7134f1c18
Merge pull request #3628 from jdufresne/dep-plugin-version
Deprecate PIL.*ImagePlugin.__version__ attributes
2019-02-12 15:39:43 +02:00
Andrew Murray
54f6cc7ea2 Changed subprocess stdout from devnull to None 2019-02-06 19:07:53 +11:00
Jon Dufresne
a11fed32b3 Deprecate PIL.*ImagePlugin.__version__ attributes
Use PIL.__version__ instead.
2019-02-02 17:39:55 -08:00
Andrew Murray
258ec6d129 Changed subprocess stdin from devnull to None 2019-01-25 18:49:10 +11:00
Jon Dufresne
a00fc33c04 Replace .seek() magic numbers with io.SEEK_* constants
A bit more readable.

https://docs.python.org/3/library/io.html#io.IOBase.seek
2019-01-12 18:22:07 -08:00
Hugo
a3079eab9e flake8: E127 continuation line over-indented for visual indent 2018-11-11 19:01:10 +02:00
Andrew Murray
0adeb82e98 Changed Image size property to be read-only by default 2018-09-30 13:45:18 +10:00
Hugo
98caf40507
Merge pull request #3378 from hugovk/windows-gs-popup
Hide the Ghostscript progress dialog popup on Windows
2018-09-29 23:09:16 +03:00
Hugo
9e54c14dfa
Merge pull request #2214 from jdufresne/eps-text-wrapper
Use TextIOWrapper.detach() instead of NoCloseStream
2018-09-26 15:34:24 +03:00
Hugo
ae415907cb flake8 and tidy up 2018-09-26 14:38:44 +03:00
Hugo
f13c150f00 Hide the Ghostscript progress dialog on Windows 2018-09-26 14:38:33 +03:00
Jon Dufresne
37f10651bd Clean up commented out debug print statements 2018-09-04 20:02:42 -07:00
Jon Dufresne
7e67b9c58f Use TextIOWrapper.detach() instead of NoCloseStream
Usage and this pattern is discussed in Python bug: https://bugs.python.org/issue21363
2018-09-04 19:30:36 -07:00
Jon Dufresne
1ba14783d2 Avoid deprecated 'U' mode when opening files
Instead, use PSFile() wrapper to handle all newline in the EPS spec.

Update line ending tests to handle all combinations of '\n' and '\r'.

Fixes warning "DeprecationWarning: 'U' mode is deprecated" in tests.
2018-07-01 08:07:59 -07:00
Andrew Murray
b4e6cdadac Added py3 variable to _util 2018-04-20 09:19:13 +10:00
Hugo
13767f045f Use named version attributes and simplify version checks 2018-03-12 10:35:29 +02:00
Andrew Murray
2202196162 Flake8 blank line fixes 2018-03-04 21:36:33 +11:00
wiredfool
0bb3f4fee9 source layout reorg 2017-12-28 14:49:47 +00:00