diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-12-05 22:02:30 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-12-05 22:02:30 +0300 |
commit | e209676d3d55c3d6a4e2fffd97cbd448a7bb556b (patch) | |
tree | a18cba90c2855c29eef1c4e7895a8b95793e8b65 /source/blender/python/api2_2x/point.c | |
parent | f98a5a80366c5307e3a286c102a6dc804b778a42 (diff) |
-- Bugfix 3453: coercion operations were doing an extra incref on coerced
objects. Also found extra increfs on some newly-created quat and matrix
objects, from calls to Matrix_Identity() and Quaternion_Identity().
Diffstat (limited to 'source/blender/python/api2_2x/point.c')
-rw-r--r-- | source/blender/python/api2_2x/point.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/source/blender/python/api2_2x/point.c b/source/blender/python/api2_2x/point.c index 2246f49b6ef..56e1eae5904 100644 --- a/source/blender/python/api2_2x/point.c +++ b/source/blender/python/api2_2x/point.c @@ -416,23 +416,19 @@ static PyObject *Point_neg(PointObject *self) then call vector.multiply(vector, scalar_cast_as_vector)*/ static int Point_coerce(PyObject ** p1, PyObject ** p2) { - PyObject *coerced = NULL; - - if(!PointObject_Check(*p2)) { - if(VectorObject_Check(*p2) || PyFloat_Check(*p2) || PyInt_Check(*p2) || + if(VectorObject_Check(*p2) || PyFloat_Check(*p2) || PyInt_Check(*p2) || MatrixObject_Check(*p2) || QuaternionObject_Check(*p2)) { - coerced = EXPP_incr_ret(*p2); - *p2 = newPointObject(NULL,3,Py_NEW); - ((PointObject*)*p2)->coerced_object = coerced; - }else{ - return EXPP_ReturnIntError(PyExc_TypeError, - "point.coerce(): unknown operand - can't coerce for numeric protocols\n"); - } + PyObject *coerced = EXPP_incr_ret(*p2); + *p2 = newPointObject(NULL,3,Py_NEW); + ((PointObject*)*p2)->coerced_object = coerced; + Py_INCREF (*p1); + return 0; } - EXPP_incr2(*p1, *p2); - return 0; + + return EXPP_ReturnIntError(PyExc_TypeError, + "point.coerce(): unknown operand - can't coerce for numeric protocols"); } -//-----------------PROTCOL DECLARATIONS-------------------------- +//-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Point_SeqMethods = { (inquiry) Point_len, /* sq_length */ (binaryfunc) 0, /* sq_concat */ |