Merge pull request #2294 from wiredfool/pypy-buffer-workaround

PyPy buffer interface workaround
This commit is contained in:
Hugo 2016-12-21 08:49:42 +02:00 committed by GitHub
commit 9c1b9e71a6
3 changed files with 12 additions and 1 deletions

View File

@ -16,6 +16,8 @@ python:
- 3.4 - 3.4
- nightly - nightly
dist: trusty
install: install:
- "travis_retry sudo apt-get update" - "travis_retry sudo apt-get update"
- "travis_retry sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick" - "travis_retry sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick"

View File

@ -58,6 +58,13 @@ install:
python setup.py install python setup.py install
python selftest.py --installed python selftest.py --installed
debug:
# make a debug version if we don't have a -dbg python. Leaves in symbols
# for our stuff, kills optimization, and redirects to dev null so we
# see any build failures.
make clean > /dev/null
CFLAGS='-g -O0' python setup.py build_ext install > /dev/null
install-req: install-req:
pip install -r requirements.txt pip install -r requirements.txt

View File

@ -251,7 +251,9 @@ int PyImaging_GetBuffer(PyObject* buffer, Py_buffer *view)
/* Use new buffer protocol if available /* Use new buffer protocol if available
(mmap doesn't support this in 2.7, go figure) */ (mmap doesn't support this in 2.7, go figure) */
if (PyObject_CheckBuffer(buffer)) { if (PyObject_CheckBuffer(buffer)) {
return PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE); int success = PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE);
if (!success) { return success; }
PyErr_Clear();
} }
/* Pretend we support the new protocol; PyBuffer_Release happily ignores /* Pretend we support the new protocol; PyBuffer_Release happily ignores