You can use Py_XDECREF instead of all the NULL checks.