libgit2/pygit2 — pull request #419 by carlosmn (2014-09-03 17:09:51+00:00)
Title: remote: clear self handle only on error

When setting the callbacks fails, we want to clear self._self_handle so
we don't leak a pointer to ourselves.

The current code used a 'finally' clause which clears it
unconditionally, which means that by the time the fetch starts, we have
no guarantee that the handle will be valid.

Replace that with an except and re-raise to make sure we only clear it
here if there was an error.