* [PATCH] rteval: return empty string in compress_cpulist for an empty list
@ 2023-08-31 20:27 John Kacur
0 siblings, 0 replies; only message in thread
From: John Kacur @ 2023-08-31 20:27 UTC (permalink / raw)
To: RT; +Cc: Juri Lelli, Clark Williams, John Kacur
If an empty list is passed to the function compress_cpulist in
systopology.py, return an empty string, or else an IndexError will be
triggered.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/systopology.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rteval/systopology.py b/rteval/systopology.py
index aca2dfd03e95..62ad3558e2e5 100644
--- a/rteval/systopology.py
+++ b/rteval/systopology.py
@@ -147,6 +147,8 @@ class CpuList:
@staticmethod
def compress_cpulist(cpulist):
""" return a string representation of cpulist """
+ if not cpulist:
+ return ""
if isinstance(cpulist[0], int):
return ",".join(str(e) for e in cpulist)
return ",".join(cpulist)
--
2.40.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-08-31 20:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 20:27 [PATCH] rteval: return empty string in compress_cpulist for an empty list John Kacur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).