Properly handle Py_INCREF/Py_DECREF for ctx object