From 24f0807550aca84fa4f3a7948a11a41c33554536 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Mar 2021 15:46:07 +1100 Subject: Cleanup: replace Py_CLEAR with Py_DECREF in bpy.app modules In this case, there is no benefit to using Py_CLEAR as the value will never be NULL and can't be used later on. --- source/blender/python/intern/bpy_app.c | 2 +- source/blender/python/intern/bpy_app_alembic.c | 4 ++-- source/blender/python/intern/bpy_app_ffmpeg.c | 4 ++-- source/blender/python/intern/bpy_app_ocio.c | 4 ++-- source/blender/python/intern/bpy_app_oiio.c | 4 ++-- source/blender/python/intern/bpy_app_opensubdiv.c | 4 ++-- source/blender/python/intern/bpy_app_openvdb.c | 4 ++-- source/blender/python/intern/bpy_app_sdl.c | 4 ++-- source/blender/python/intern/bpy_app_usd.c | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index c7e195b586d..927ec11c376 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -216,7 +216,7 @@ static PyObject *make_app_info(void) #undef SetObjItem if (PyErr_Occurred()) { - Py_CLEAR(app_info); + Py_DECREF(app_info); return NULL; } return app_info; diff --git a/source/blender/python/intern/bpy_app_alembic.c b/source/blender/python/intern/bpy_app_alembic.c index d5640045977..bb218c57d06 100644 --- a/source/blender/python/intern/bpy_app_alembic.c +++ b/source/blender/python/intern/bpy_app_alembic.c @@ -79,8 +79,8 @@ static PyObject *make_alembic_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(alembic_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(alembic_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c index 4e396668450..d2261ee7311 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.c +++ b/source/blender/python/intern/bpy_app_ffmpeg.c @@ -116,8 +116,8 @@ static PyObject *make_ffmpeg_info(void) #undef FFMPEG_LIB_VERSION - if (PyErr_Occurred()) { - Py_CLEAR(ffmpeg_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(ffmpeg_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_ocio.c b/source/blender/python/intern/bpy_app_ocio.c index 3a36e90018f..8ce87bd0150 100644 --- a/source/blender/python/intern/bpy_app_ocio.c +++ b/source/blender/python/intern/bpy_app_ocio.c @@ -81,8 +81,8 @@ static PyObject *make_ocio_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(ocio_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(ocio_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_oiio.c b/source/blender/python/intern/bpy_app_oiio.c index 0038f982170..8436296680b 100644 --- a/source/blender/python/intern/bpy_app_oiio.c +++ b/source/blender/python/intern/bpy_app_oiio.c @@ -77,8 +77,8 @@ static PyObject *make_oiio_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(oiio_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(oiio_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_opensubdiv.c b/source/blender/python/intern/bpy_app_opensubdiv.c index 90aab2a4500..635013a1f9e 100644 --- a/source/blender/python/intern/bpy_app_opensubdiv.c +++ b/source/blender/python/intern/bpy_app_opensubdiv.c @@ -74,8 +74,8 @@ static PyObject *make_opensubdiv_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(opensubdiv_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(opensubdiv_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_openvdb.c b/source/blender/python/intern/bpy_app_openvdb.c index c98c6ec0137..20a61ba170a 100644 --- a/source/blender/python/intern/bpy_app_openvdb.c +++ b/source/blender/python/intern/bpy_app_openvdb.c @@ -81,8 +81,8 @@ static PyObject *make_openvdb_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(openvdb_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(openvdb_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_sdl.c b/source/blender/python/intern/bpy_app_sdl.c index 645119c1c5d..e45e73fb4de 100644 --- a/source/blender/python/intern/bpy_app_sdl.c +++ b/source/blender/python/intern/bpy_app_sdl.c @@ -114,8 +114,8 @@ static PyObject *make_sdl_info(void) SetObjItem(PyBool_FromLong(0)); #endif - if (PyErr_Occurred()) { - Py_CLEAR(sdl_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(sdl_info); return NULL; } diff --git a/source/blender/python/intern/bpy_app_usd.c b/source/blender/python/intern/bpy_app_usd.c index 4a0ee96061a..72287d45b93 100644 --- a/source/blender/python/intern/bpy_app_usd.c +++ b/source/blender/python/intern/bpy_app_usd.c @@ -80,8 +80,8 @@ static PyObject *make_usd_info(void) SetStrItem("Unknown"); #endif - if (PyErr_Occurred()) { - Py_CLEAR(usd_info); + if (UNLIKELY(PyErr_Occurred())) { + Py_DECREF(usd_info); return NULL; } -- cgit v1.2.3