Commits

illume committed 35b6257

A patch for issue #172 from Lorenz Quack for inplace operators in Math.Vector2.

  • Participants
  • Parent commits 62f6142

Comments (0)

Files changed (1)

     else
         op |= OP_ARG_UNKNOWN;
 
-    if (op & OP_INPLACE)
-        ret = vec;
+    if (op & OP_INPLACE) {
+         ret = vec;
+        Py_INCREF(ret);
+    }
     else if (op != (OP_MUL | OP_ARG_VECTOR) &&
              op != (OP_MUL | OP_ARG_VECTOR | OP_ARG_REVERSE)) {
         ret = (PyVector*)PyVector_NEW(dim);
             ret->coords[i] = floor(vec_coords[i] * tmp);
         break;
     default:
-        if (!(op & OP_INPLACE)) {
-            Py_XDECREF(ret);
-        }
+        Py_XDECREF(ret);
         Py_INCREF(Py_NotImplemented);
         return Py_NotImplemented;
     }