Move COMMAND_NESTING safety handler into try..except..finally clause to avoid it ticking up accidentally due to the loop exiting from a traceback.

This commit is contained in:
Griatch 2016-09-03 22:52:29 +02:00
parent 2ed92e8149
commit 17ee28ab6c

View file

@ -472,7 +472,6 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
caller.ndb.last_cmd = yield copy(cmd)
else:
caller.ndb.last_cmd = None
_COMMAND_NESTING[called_by] -= 1
# return result to the deferred
returnValue(ret)
@ -480,6 +479,9 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess
except Exception:
_msg_err(caller, _ERROR_UNTRAPPED)
raise ErrorReported
finally:
_COMMAND_NESTING[called_by] -= 1
raw_string = to_unicode(raw_string, force_string=True)