pyldb: add a macro to free when raising exceptions