diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-13 04:54:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-13 04:54:59 +0400 |
commit | 37cf28b3412f0d888b16e793360b9d064be1aa25 (patch) | |
tree | 04efc57a0a6329b7f93ea4021ee7418d3a6902e2 /source/blender/freestyle/intern/python/BPy_Nature.cpp | |
parent | 2d0997766d7c4fd1850bcc7ae8ea7197aedb43c7 (diff) |
Freestyle: avoid checking PyErr_Occurred and quiet warning
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_Nature.cpp')
-rw-r--r-- | source/blender/freestyle/intern/python/BPy_Nature.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index bf571bada6a..bf27bc1d4ed 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -268,26 +268,28 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) PyErr_SetString(PyExc_TypeError, "operands must be a Nature object"); return NULL; } - op1 = PyLong_AsLong(a); - if (PyErr_Occurred()) { + + if ((op1 = PyLong_AsLong(a)) == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value"); return NULL; } - op2 = PyLong_AsLong(b); - if (PyErr_Occurred()) { + if ((op2 = PyLong_AsLong(b)) == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value"); return NULL; } switch (op) { - case '&': - v = op1 & op2; - break; - case '^': - v = op1 ^ op2; - break; - case '|': - v = op1 | op2; - break; + case '&': + v = op1 & op2; + break; + case '^': + v = op1 ^ op2; + break; + case '|': + v = op1 | op2; + break; + default: + BLI_assert(0); + v = 0; } if (v == 0) result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0); |