diff --git a/PIL/Image.py b/PIL/Image.py index ec995c8f4..f0437ab2a 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -56,7 +56,10 @@ try: from . 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") + "version of Pillow or PIL: Core Version: %s" + "Pillow Version: %s" % + (getattr(core, 'PILLOW_VERSION', None), + PILLOW_VERSION)) except ImportError as v: core = _imaging_not_installed() diff --git a/_imaging.c b/_imaging.c index 9ff706ced..85c32ce40 100644 --- a/_imaging.c +++ b/_imaging.c @@ -3435,6 +3435,7 @@ static PyMethodDef functions[] = { static int setup_module(PyObject* m) { PyObject* d = PyModule_GetDict(m); + const char* version = (char*)PILLOW_VERSION; /* Ready object types */ if (PyType_Ready(&Imaging_Type) < 0) @@ -3479,7 +3480,7 @@ setup_module(PyObject* m) { } #endif - PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(PILLOW_VERSION)); + PyDict_SetItemString(d, "PILLOW_VERSION", PyUnicode_FromString(version)); return 0; } diff --git a/setup.py b/setup.py index 9aa6fbf26..3a8a5987f 100755 --- a/setup.py +++ b/setup.py @@ -584,7 +584,10 @@ class pil_build_ext(build_ext): if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1: defs.append(("WORDS_BIGENDIAN", None)) - defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION)) + if sys.platform == "win32": + defs.append(("PILLOW_VERSION", '"\\"%s\\""'%PILLOW_VERSION)) + else: + defs.append(("PILLOW_VERSION", '"%s"'%PILLOW_VERSION)) exts = [(Extension("PIL._imaging", files,