Properly handle Py_INCREF/Py_DECREF for PyObject ctx. This helps with the crashes due to garbage collected ctx