mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-11 17:56:18 +03:00
Moved line after early return
Improve compiler advice Update src/PIL/features.py
This commit is contained in:
parent
6180abc75c
commit
924df9e60b
|
@ -148,11 +148,10 @@ def check_feature(feature: str) -> bool | None:
|
|||
|
||||
try:
|
||||
imported_module = __import__(module, fromlist=["PIL"])
|
||||
if isinstance(flag, str):
|
||||
return getattr(imported_module, flag)
|
||||
else:
|
||||
if isinstance(flag, bool):
|
||||
_deprecate.deprecate(f'check_feature("{feature}")', 12)
|
||||
return flag
|
||||
return getattr(imported_module, flag)
|
||||
except ModuleNotFoundError:
|
||||
return None
|
||||
except ImportError as ex:
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* versions, before enabling animation support.
|
||||
*/
|
||||
#if WEBP_MUX_ABI_VERSION < 0x0106 || WEBP_DEMUX_ABI_VERSION < 0x0107
|
||||
#error libwebp 0.5.0 and above is required. Upgrade libwebp or build with --disable-webp flag
|
||||
#error libwebp 0.5.0 and above is required. Upgrade libwebp or build Pillow with --disable-webp flag
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -784,13 +784,13 @@ static PyMethodDef webpMethods[] = {
|
|||
|
||||
static int
|
||||
setup_module(PyObject *m) {
|
||||
PyObject *d = PyModule_GetDict(m);
|
||||
/* Ready object types */
|
||||
if (PyType_Ready(&WebPAnimDecoder_Type) < 0 ||
|
||||
PyType_Ready(&WebPAnimEncoder_Type) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PyObject *d = PyModule_GetDict(m);
|
||||
PyObject *v = PyUnicode_FromString(WebPDecoderVersion_str());
|
||||
PyDict_SetItemString(d, "webpdecoder_version", v ? v : Py_None);
|
||||
Py_XDECREF(v);
|
||||
|
|
Loading…
Reference in New Issue
Block a user