BpmnParser.find_all_specs() breaks with nested subprocess
asauve2 opened this issue · 1 comments
asauve2 commented
During the loading process of a workflow a dictionary is updated while
being iterated in BpmnParser.py
This results in
RuntimeError: dictionary changed size during iteration
when there are two levels of nestings of subprocess workflows.
As I cannot post pull request, the fix consist only in making a copy of dict keys
that would look like the snippet below:
def find_all_specs(self):
# This is a little convoluted, but we might add more processes as we generate
# the dictionary if something refers to another subprocess that we haven't seen.
processes = dict((id, self.get_spec(id)) for id in self.get_process_ids())
while sorted(processes.keys()) != sorted(self.process_parsers.keys()):
for process_id in tuple(self.process_parsers.keys()): # <===============
processes[process_id] = self.get_spec(process_id)
return processes
As I'm not sure if the python API would return consistently the keys in the same order
I also added a sorted()
call for the comparison. Any comment on this part would be welcome.