Commit Graph

53 Commits

Author SHA1 Message Date
wiredfool
533f4145bb return values 2016-06-27 00:58:06 -07:00
wiredfool
653b170385 incorrect use of whitespace 2016-06-27 00:58:05 -07:00
wiredfool
d3b0413780 Initial take for removing the Incremental decoder due to threading issues. J2k tests pass, other tests fail 2016-06-27 00:58:05 -07:00
Henrique Dante de Almeida
a7c58303ca Make ImageFile load images in read-only mode
The code path for mmapped files unnecessarily loaded images in
read-write mode and had a long standing FIXME message. This patch
uses mmap.ACCESS_READ, which is platform independent to fix this
issue.
2016-04-27 09:39:51 -03:00
Andrew Murray
9014517602 Removed logger exception 2015-12-10 08:39:26 +11:00
wiredfool
4a8a983e6a Merge pull request #1398 from mrTable/master
Check flush method existence for file-like object
2015-10-01 07:54:26 -07:00
homm
613f1e241e do not raise on broken images 2015-09-15 19:11:45 +03:00
homm
1d236f0262 unused var 2015-09-08 17:43:12 +03:00
homm
b078ad4599 raise IOError in all cases when image can't be loaded 2015-09-08 17:43:12 +03:00
homm
b8b3cdc146 fix truncated images loading 2015-09-08 17:43:11 +03:00
Andrew Murray
d21430234e Improved consistency of checks for flush 2015-09-02 23:48:22 +10:00
Andrew Murray
c6b13d294f Flake8 fixes 2015-08-25 22:27:18 +10:00
Andrew Murray
f5df0b86fc Fixed PSDraw stdout Python 3 compatibility 2015-07-31 20:59:59 +10:00
Antony Lee
4e754e9c55 Use logging instead of print.
cf. #1191.

Only TiffImagePlugin and OLEFileIO still rely on (their own) DEBUG flag.
I left TiffImagePlugin as it is because I hope #1059 gets merged in
first, and OLEFileIO because it uses its own logic.

Untested, as usual.
2015-06-29 12:39:50 -07:00
Andrew Murray
77e2878734 Fixed redefining built-ins 2015-06-02 00:09:18 +10:00
Andrew Murray
3c7e37d2d7 Replaced old-style classes 2015-05-27 00:07:21 +10:00
Andrew Murray
ee34d6843b Further health fixes 2015-04-24 18:24:52 +10:00
George Davaris
68663ad352 Define t variable in a more appropriate place 2015-04-01 10:48:28 +01:00
George Davaris
5a49375d4f Fix UnboundLocalError in ImageFile 2015-03-11 15:37:02 +00:00
hugovk
1de128d6b6 Merge branch 'master' into flake8 2014-09-14 10:23:51 +03:00
Josh Ware
94194ed248 Cleaning up.
Reduced memory limit to 1GB
2014-09-12 22:09:27 -07:00
Josh Ware
7407371deb NULLing pointers on cleanup 2014-09-12 22:09:27 -07:00
Josh Ware
3da6768a72 Testing whether e.cleanup causes segfaults 2014-09-12 22:09:27 -07:00
Josh Ware
caa95a26b2 Added memory leak fix and testing for Encoder 2014-09-12 22:09:27 -07:00
Josh Ware
7db19efe75 Reduced JPEG2000 test iterations, and added cleanup for decoding using PyPy 2014-09-12 22:09:27 -07:00
hugovk
8de95676e0 flake8 2014-08-26 16:47:10 +03:00
wiredfool
d30eb007ef Fix scrambled XPM image, don't mmap when load_read/load_seek is defined. Fixes #806 2014-07-18 10:40:08 -07:00
wiredfool
54173d2c67 Cherry-pick of portions of patch a500ca1393, many shortcut ops added, no functional changes 2014-05-09 21:36:15 -07:00
Alastair Houghton
d6b8f0f666 Added a JPEG 2000 decoder based on OpenJPEG. 2014-03-13 11:46:47 +00:00
homm
0a256f9e56 fix UnboundLocalError: local variable 't' referenced before assignment 2014-01-15 16:55:10 +04:00
Stephen Johnson
348daf9490 Document ImageFile.Parser 2013-10-12 13:57:27 -07:00
wiredfool
258434b8ef Fix test failures for Pypy 2.1 around memory mapping 2013-10-02 09:56:29 -07:00
Alex Clark
f6da8c24dc Revert "Added IGNORE_DECODING_ERRORS flag to ImageFile allowing corrupted images to load"
This reverts commit 156a443cdf.
2013-07-31 11:22:38 -04:00
Cezar Sa Espinola
156a443cdf Added IGNORE_DECODING_ERRORS flag to ImageFile allowing corrupted images to load 2013-07-30 16:38:56 -03:00
Felipe Reyes
a560022341 Transformed docstrings of ImageFile and ImageFileIO modules 2013-07-19 15:11:26 +00:00
Alex Clark
bb1b3a532c Cleanup WS, courtesy of @Arfrever
find * -type f "-(" -name "*.bdf" -o -name "*.c" -o -name "*.h" -o -name "*.py" -o -name "*.rst" -o -name "*.txt" "-)" -exec sed -e "s/[[:space:]]*$//" -i {} \;
2013-06-30 18:42:19 -04:00
Alex Clark
fd29e707e9 Apply @Arfrever patch, fixes #258 2013-06-30 07:04:42 -04:00
wiredfool
158cdbe8db Enabling cleanup
Enabling the cleanup call in ImageFile.load
2013-05-16 08:32:24 -06:00
wiredfool
f6381ba00c Added cleanup method to prevent memory leaks from truncated jpeg decodes 2013-05-15 21:16:37 -07:00
wiredfool
2a743c9527 JpegImagePlugin sets bufsize for optimized images 2013-03-22 22:27:12 -07:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Mikhail Korobov
bb4eb53859 fix UnboundLocalError errors 2013-02-26 16:31:44 +06:00
David Schmidt
33bf5d9d37 Improved load truncated images 2013-01-11 14:40:02 +01:00
d-schmidt
54d4f5eb3c added option to load truncated image-files 2013-01-10 20:44:41 +01:00
Brian Crowell
63be4a1334 py3k: Get rid of _ParserFile; io.BytesIO does its job 2013-01-10 08:46:59 -06:00
Brian Crowell
a7e3b2e47b py3k: The big push
There are two main issues fixed with this commit:

* bytes vs. str: All file, image, and palette data are now handled as
  bytes. A new _binary module consolidates the hacks needed to do this
  across Python versions. tostring/fromstring methods have been renamed to
  tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old
  names for compatibility. Users should move to tobytes/frombytes.

  One other potentially-breaking change is that text data in image files
  (such as tags, comments) are now explicitly handled with a specific
  character encoding in mind. This works well with the Unicode str in
  Python 3, but may trip up old code expecting a straight byte-for-byte
  translation to a Python string. This also required a change to Gohlke's
  tags tests (in Tests/test_file_png.py) to expect Unicode strings from
  the code.

* True div vs. floor div: Many division operations used the "/" operator
  to do floor division, which is now the "//" operator in Python 3. These
  were fixed.

As of this commit, on the first pass, I have one failing test (improper
handling of a slice object in a C module, test_imagepath.py) in Python 3,
and three that that I haven't tried running yet (test_imagegl,
test_imagegrab, and test_imageqt). I also haven't tested anything on
Windows. All but the three skipped tests run flawlessly against Pythons
2.6 and 2.7.
2013-01-10 08:46:56 -06:00
Brian Crowell
80c2fa60ae py3k: Sort by key, not cmp
Py3k only supports key because it's more efficient. Not even sure 2to3
checks for this.
2013-01-10 08:46:54 -06:00
Brian Crowell
31c454b925 py3k: 2to3's "idiom" filter
This is, I guess, a few things the Python devs were just fed up with.

* "while 1" is now "while True"
* Types are compared with isinstance instead of ==
* Sort a list in one go with sorted()

My own twist is to also replace type('') with str, type(()) with tuple,
type([]) with list, type(1) with int, and type(5000.0) with float.
2013-01-10 08:46:53 -06:00
Brian Crowell
83ff0b3b31 py3k: Use relative imports
In py3k, imports are absolute unless using the "from . import" syntax.

This commit also solves a recursive import between Image, ImageColor, and
ImagePalette by delay-importing ImagePalette in Image.

I'm not too keen on this commit because the syntax is ugly. I might go back
and prefer the prettier "from PIL import".
2013-01-10 08:46:48 -06:00
Brian Crowell
197885164b py3k: Backport Gohlke's tests to run on 2.6/2.7
Most of the differences are in tobytes/tostring naming and expected
behavior of the bytes() constructor. The latter was usually easy to fix
with the right bytes literal.

This is a good preview of what will have to happen in the Python 3 code.
2013-01-10 08:46:39 -06:00