Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-19 17:35:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-19 17:35:19 +0400
commitc285b16f6534ed077134d57df8345c11cd915357 (patch)
tree4b39611aab5a79c18c62ed9401a5cbff7c1ef66b
parent9711a0034fc1d508e4e49b7cc991c377789a4499 (diff)
svn merge ^/trunk/blender -c56867v2.67a
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp
index 4f8b1f8f4d5..da09de99590 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp
@@ -263,41 +263,34 @@ int Nature_Init(PyObject *module)
static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b)
{
BPy_Nature *result;
+ long op1, op2;
if (!BPy_Nature_Check(a) || !BPy_Nature_Check(b)) {
PyErr_SetString(PyExc_TypeError, "operands must be a Nature object");
return NULL;
}
- if (Py_SIZE(a) != 1) {
- stringstream msg;
- msg << "operand 1: unexpected Nature byte length: " << Py_SIZE(a);
- PyErr_SetString(PyExc_TypeError, msg.str().c_str());
+ op1 = PyLong_AsLong(a);
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value");
return NULL;
}
- if (Py_SIZE(b) != 1) {
- stringstream msg;
- msg << "operand 2: unexpected Nature byte length: " << Py_SIZE(b);
- PyErr_SetString(PyExc_TypeError, msg.str().c_str());
+ op2 = PyLong_AsLong(b);
+ if (PyErr_Occurred()) {
+ PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value");
return NULL;
}
result = PyObject_NewVar(BPy_Nature, &Nature_Type, 1);
if (!result)
return NULL;
- if (Py_SIZE(result) != 1) {
- stringstream msg;
- msg << "unexpected Nature byte length: " << Py_SIZE(result);
- PyErr_SetString(PyExc_TypeError, msg.str().c_str());
- return NULL;
- }
switch (op) {
case '&':
- result->i.ob_digit[0] = (((PyLongObject *)a)->ob_digit[0]) & (((PyLongObject *)b)->ob_digit)[0];
+ result->i.ob_digit[0] = op1 & op2;
break;
case '^':
- result->i.ob_digit[0] = (((PyLongObject *)a)->ob_digit[0]) ^ (((PyLongObject *)b)->ob_digit)[0];
+ result->i.ob_digit[0] = op1 ^ op2;
break;
case '|':
- result->i.ob_digit[0] = (((PyLongObject *)a)->ob_digit[0]) | (((PyLongObject *)b)->ob_digit)[0];
+ result->i.ob_digit[0] = op1 | op2;
break;
}
return (PyObject *)result;