Freestyle: avoid checking PyErr_Occurred and quiet warning
This commit is contained in:
@@ -268,13 +268,12 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b)
|
|||||||
PyErr_SetString(PyExc_TypeError, "operands must be a Nature object");
|
PyErr_SetString(PyExc_TypeError, "operands must be a Nature object");
|
||||||
return NULL;
|
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");
|
PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
op2 = PyLong_AsLong(b);
|
if ((op2 = PyLong_AsLong(b)) == -1 && PyErr_Occurred()) {
|
||||||
if (PyErr_Occurred()) {
|
|
||||||
PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value");
|
PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -288,6 +287,9 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b)
|
|||||||
case '|':
|
case '|':
|
||||||
v = op1 | op2;
|
v = op1 | op2;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
BLI_assert(0);
|
||||||
|
v = 0;
|
||||||
}
|
}
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0);
|
result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user