From 99af124f8019efa28451ee92c8b581358336ba42 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Tue, 23 Feb 2021 19:58:39 +0100 Subject: [PATCH] [ARCH] Arch_Roof fix for adjust_list_len function LGTM code analysis did not like that the adjust_list_len function would mutate default list values. De function now always clones the list. See: https://forum.freecadweb.org/viewtopic.php?f=23&t=55943 --- src/Mod/Arch/ArchRoof.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchRoof.py b/src/Mod/Arch/ArchRoof.py index 99130d0e43..59b8eb2a6f 100644 --- a/src/Mod/Arch/ArchRoof.py +++ b/src/Mod/Arch/ArchRoof.py @@ -49,7 +49,7 @@ else: # \brief The Roof object and tools # # This module provides tools to build Roof objects. -# Roofs are build from a closed contour and a series of +# Roofs are built from a closed contour and a series of # slopes. __title__ = "FreeCAD Roof" @@ -58,13 +58,12 @@ __url__ = "https://www.freecadweb.org" def adjust_list_len (lst, newLn, val): + '''Returns a clone of lst with length newLn, val is appended if required''' ln = len(lst) if ln > newLn: return lst[0:newLn] else: - for i in range(newLn - ln): - lst.append(val) - return lst + return lst[:] + ([val] * (newLn - ln)) def find_inters (edge1, edge2, infinite1=True, infinite2=True):