Use the do-while 0 idiom for cursor guards macro
Don't segfault on uninitialized cursor

It can happen with bad cursor subclasses not calling super's init. Raise
an exception instead of segfaulting.

Closes #195