@ -598,28 +598,22 @@ class PlayIterator:
if state . tasks_child_state :
if state . tasks_child_state :
state . tasks_child_state = self . _insert_tasks_into_state ( state . tasks_child_state , task_list )
state . tasks_child_state = self . _insert_tasks_into_state ( state . tasks_child_state , task_list )
else :
else :
target_block = state . _blocks [ state . cur_block ] . copy ( )
target_block = state . _blocks [ state . cur_block ] . copy ( exclude_tasks = True )
before = target_block . block [ : state . cur_regular_task ]
target_block . block [ state . cur_regular_task : state . cur_regular_task ] = task_list
after = target_block . block [ state . cur_regular_task : ]
target_block . block = before + task_list + after
state . _blocks [ state . cur_block ] = target_block
state . _blocks [ state . cur_block ] = target_block
elif state . run_state == IteratingStates . RESCUE :
elif state . run_state == IteratingStates . RESCUE :
if state . rescue_child_state :
if state . rescue_child_state :
state . rescue_child_state = self . _insert_tasks_into_state ( state . rescue_child_state , task_list )
state . rescue_child_state = self . _insert_tasks_into_state ( state . rescue_child_state , task_list )
else :
else :
target_block = state . _blocks [ state . cur_block ] . copy ( )
target_block = state . _blocks [ state . cur_block ] . copy ( exclude_tasks = True )
before = target_block . rescue [ : state . cur_rescue_task ]
target_block . rescue [ state . cur_rescue_task : state . cur_rescue_task ] = task_list
after = target_block . rescue [ state . cur_rescue_task : ]
target_block . rescue = before + task_list + after
state . _blocks [ state . cur_block ] = target_block
state . _blocks [ state . cur_block ] = target_block
elif state . run_state == IteratingStates . ALWAYS :
elif state . run_state == IteratingStates . ALWAYS :
if state . always_child_state :
if state . always_child_state :
state . always_child_state = self . _insert_tasks_into_state ( state . always_child_state , task_list )
state . always_child_state = self . _insert_tasks_into_state ( state . always_child_state , task_list )
else :
else :
target_block = state . _blocks [ state . cur_block ] . copy ( )
target_block = state . _blocks [ state . cur_block ] . copy ( exclude_tasks = True )
before = target_block . always [ : state . cur_always_task ]
target_block . always [ state . cur_always_task : state . cur_always_task ] = task_list
after = target_block . always [ state . cur_always_task : ]
target_block . always = before + task_list + after
state . _blocks [ state . cur_block ] = target_block
state . _blocks [ state . cur_block ] = target_block
elif state . run_state == IteratingStates . HANDLERS :
elif state . run_state == IteratingStates . HANDLERS :
state . handlers [ state . cur_handlers_task : state . cur_handlers_task ] = [ h for b in task_list for h in b . block ]
state . handlers [ state . cur_handlers_task : state . cur_handlers_task ] = [ h for b in task_list for h in b . block ]