[PATCH] D74593: Fixes a bug in pstat module

Alexander Polyakov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 01:17:59 PST 2020


apolyakov created this revision.
apolyakov added reviewers: cmatthews, leandron, hubert.reinterpretcast.

There was a bug in the pstat module: LNT crashes with
"UnboundLocalError: local variable 'list' referenced before assignment"
when trying to add linear regression to the regression graph.


https://reviews.llvm.org/D74593

Files:
  lnt/external/stats/pstat.py


Index: lnt/external/stats/pstat.py
===================================================================
--- lnt/external/stats/pstat.py
+++ lnt/external/stats/pstat.py
@@ -182,22 +182,22 @@
     if not isinstance(addon, (list, tuple)):
         addon = [addon]
     minlen = min(len(source), len(addon))
-    list = copy.deepcopy(source)                # start abut process
+    source_copy = copy.deepcopy(source)                # start abut process
     if not isinstance(source[0], (list, tuple)):
         if not isinstance(addon[0], (list, tuple)):
             for i in range(minlen):
-                list[i] = [source[i]] + [addon[i]]        # source/addon = column
+                source_copy[i] = [source[i]] + [addon[i]]        # source/addon = column
         else:
             for i in range(minlen):
-                list[i] = [source[i]] + addon[i]        # addon=list-of-lists
+                source_copy[i] = [source[i]] + addon[i]        # addon=list-of-lists
     else:
         if not isinstance(addon[0], (list, tuple)):
             for i in range(minlen):
-                list[i] = source[i] + [addon[i]]        # source=list-of-lists
+                source_copy[i] = source[i] + [addon[i]]        # source=list-of-lists
         else:
             for i in range(minlen):
-                list[i] = source[i] + addon[i]        # source/addon = list-of-lists
-    source = list
+                source_copy[i] = source[i] + addon[i]        # source/addon = list-of-lists
+    source = source_copy
     return source
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74593.244583.patch
Type: text/x-patch
Size: 1547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200214/2987576c/attachment.bin>


More information about the llvm-commits mailing list