mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 00:46:16 +03:00
- Fix _webp reference when _webp is not available
- HandleMuxError function needs to be tied to WEBP_HAVEMUX, not WEBP_HAVEANIM
This commit is contained in:
parent
405d1a64d8
commit
acc4334291
|
@ -5,8 +5,10 @@ from PIL import Image
|
|||
try:
|
||||
from PIL import _webp
|
||||
HAVE_WEBP = True
|
||||
HAVE_WEBPANIM = True
|
||||
except ImportError:
|
||||
HAVE_WEBP = False
|
||||
HAVE_WEBPANIM = False
|
||||
|
||||
class TestFileWebpMetadata(PillowTestCase):
|
||||
|
||||
|
@ -110,7 +112,7 @@ class TestFileWebpMetadata(PillowTestCase):
|
|||
|
||||
self.assertFalse(webp_image._getexif())
|
||||
|
||||
@unittest.skipUnless(_webp.HAVE_WEBPANIM, 'WebP animation support not available')
|
||||
@unittest.skipUnless(HAVE_WEBPANIM, 'WebP animation support not available')
|
||||
def test_write_animated_metadata(self):
|
||||
iccp_data = '<iccp_data>'.encode('utf-8')
|
||||
exif_data = '<exif_data>'.encode('utf-8')
|
||||
|
|
9
_webp.c
9
_webp.c
|
@ -19,14 +19,15 @@
|
|||
#if WEBP_MUX_ABI_VERSION >= 0x0104 && WEBP_DEMUX_ABI_VERSION >= 0x0105
|
||||
#define HAVE_WEBPANIM
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WEBPANIM
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* WebP Muxer Error Handling */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef HAVE_WEBPMUX
|
||||
|
||||
static const char* const kErrorMessages[-WEBP_MUX_NOT_ENOUGH_DATA + 1] = {
|
||||
"WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_BAD_DATA",
|
||||
"WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_NOT_ENOUGH_DATA"
|
||||
|
@ -67,10 +68,14 @@ PyObject* HandleMuxError(WebPMuxError err, char* chunk) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* WebP Animation Support */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#ifdef HAVE_WEBPANIM
|
||||
|
||||
// Encoder type
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
|
Loading…
Reference in New Issue
Block a user