[Bf-blender-cvs] [e8fd2d84692] master: Cleanup: early exit when there is no exception

Campbell Barton noreply at git.blender.org
Mon Mar 28 06:09:01 CEST 2022


Commit: e8fd2d846926a9ee1a934e68e7dd69ced10080f5
Author: Campbell Barton
Date:   Mon Mar 28 15:05:41 2022 +1100
Branches: master
https://developer.blender.org/rBe8fd2d846926a9ee1a934e68e7dd69ced10080f5

Cleanup: early exit when there is no exception

Reduces noise in D9752, no functional change as PyErr_NormalizeException
doesn't do anything when there is no exception set.

===================================================================

M	source/blender/python/intern/bpy_traceback.c

===================================================================

diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index 13af254c286..fb89925400e 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -124,8 +124,11 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
   *offset = 0;
 
   PyErr_Fetch(&exception, &value, (PyObject **)&tb);
+  if (exception == NULL) {
+    return;
+  }
 
-  if (exception && PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) {
+  if (PyErr_GivenExceptionMatches(exception, PyExc_SyntaxError)) {
     /* no trace-back available when `SyntaxError`.
      * python has no API's to this. reference #parse_syntax_error() from pythonrun.c */
     PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);



More information about the Bf-blender-cvs mailing list