From 4c0884e16d02ef132ab5a2e584765f2c5ea17cb3 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 29 May 2018 03:42:35 +0300 Subject: [PATCH] - when using .keys method (in Python3 is no longer atomic operation) to make it more resilient to multithreading I've added the more costing operation of copy(). --- FlatCAMObj.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 1d6e7754..6599f873 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -729,20 +729,20 @@ class FlatCAMExcellon(FlatCAMObj, Excellon): exc_final.drills.append({"point": point, "tool": drill['tool']}) toolsrework=dict() max_numeric_tool=0 - for toolname in list(exc.tools.keys()): + for toolname in list(exc.tools.copy().keys()): numeric_tool=int(toolname) if numeric_tool>max_numeric_tool: max_numeric_tool=numeric_tool toolsrework[exc.tools[toolname]['C']]=toolname #exc_final as last because names from final tools will be used - for toolname in list(exc_final.tools.keys()): + for toolname in list(exc_final.tools.copy().keys()): numeric_tool=int(toolname) if numeric_tool>max_numeric_tool: max_numeric_tool=numeric_tool toolsrework[exc_final.tools[toolname]['C']]=toolname - for toolvalues in list(toolsrework.keys()): + for toolvalues in list(toolsrework.copy().keys()): if toolsrework[toolvalues] in exc_final.tools: if exc_final.tools[toolsrework[toolvalues]]!={"C": toolvalues}: exc_final.tools[str(max_numeric_tool+1)]={"C": toolvalues}