Skip to content

Commit c4396e0

Browse files
committed
Fix single entry VPSet template bug
If a VPSet had a single entry and defined a `template` then a `dumpPython` would not create a syntactically correct output.
1 parent db17e7b commit c4396e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

FWCore/ParameterSet/python/Mixins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ def dumpPython(self, options:PrintOptions=PrintOptions()) -> str:
697697
if n>=256:
698698
#wrap in a tuple since they don't have a size constraint
699699
result+=" ("
700+
wroteAtLeastOne = False
700701
for i, v in enumerate(self):
702+
wroteAtLeastOne = True
701703
if i == 0:
702704
if n>nPerLine: result += '\n'+options.indentation()
703705
else:
@@ -710,7 +712,7 @@ def dumpPython(self, options:PrintOptions=PrintOptions()) -> str:
710712
result +=' ) '
711713
moreArgs = self._additionalInitArguments(options)
712714
if moreArgs:
713-
if i > 0:
715+
if wroteAtLeastOne:
714716
result += ', \n' + options.indentation()
715717
result += moreArgs
716718
if n>nPerLine:

0 commit comments

Comments
 (0)