mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
basic sanity check that the version of the _imaging.c and Image.py files are the same
This commit is contained in:
parent
7f698a6fc5
commit
088c752e40
|
@ -27,6 +27,7 @@
|
|||
from __future__ import print_function
|
||||
|
||||
VERSION = "1.1.7"
|
||||
PILLOW_VERSION = "2.0.0"
|
||||
|
||||
try:
|
||||
import warnings
|
||||
|
@ -54,6 +55,11 @@ try:
|
|||
# them. Note that other modules should not refer to _imaging
|
||||
# directly; import Image and use the Image.core variable instead.
|
||||
from PIL import _imaging as core
|
||||
if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
|
||||
raise ImportError("The _imaging extension was built for another "
|
||||
" version of Pillow or PIL. Most PIL functions "
|
||||
" will be disabled ")
|
||||
|
||||
except ImportError as v:
|
||||
core = _imaging_not_installed()
|
||||
if str(v)[:20] == "Module use of python" and warnings:
|
||||
|
@ -65,6 +71,8 @@ except ImportError as v:
|
|||
"of Python; most PIL functions will be disabled",
|
||||
RuntimeWarning
|
||||
)
|
||||
if str(v).startswith("The _imaging extension") and warnings:
|
||||
warnings.warn(str(v), RuntimeWarning)
|
||||
|
||||
try:
|
||||
import builtins
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
* See the README file for information on usage and redistribution.
|
||||
*/
|
||||
|
||||
#define PILLOW_VERSION "2.0.0"
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
|
@ -3431,6 +3432,8 @@ setup_module(PyObject* m) {
|
|||
}
|
||||
#endif
|
||||
|
||||
PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(PILLOW_VERSION));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user