Skip to content

Commit

Permalink
Moved line after early return
Browse files Browse the repository at this point in the history
Improve compiler advice

Update src/PIL/features.py
  • Loading branch information
radarhere authored and homm committed Aug 13, 2024
1 parent 6180abc commit 924df9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 924df9e

Please sign in to comment.