[hook] Connection doesn't have "warn"
How to reproduce: create a hook and add a commit()
in a precommit event.
It will trigger this part of code:
@_open_only
def commit(self):
"""commit the current session's transaction"""
assert self.cnxset is not None
cstate = self.commit_state
if cstate == 'uncommitable':
raise QueryError('transaction must be rolled back')
if cstate == 'precommit':
self.warn('calling commit in precommit makes no sense; ignoring commit')
return
But self.warn
is not defined ... so it'll raise an exception.