Commit 9ed4ea58 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Never use [-1] index on a tuple - what if you add more fields?

parent dceb9bf0
......@@ -265,7 +265,7 @@ def CommonSeqSetChoice(nodeTypename: str,
for c in node._members:
cleanFieldname = CleanName(c[0])
memberAssignments.append(
'if self.kind == DV.' + c[-1] + ':')
'if self.kind == DV.' + c[2] + ':')
memberAssignments.append(' pyObj.Reset(state)')
assert isinstance(c[1], AsnMetaMember)
containedTypename = CleanName(c[1]._containedType)
......@@ -346,7 +346,7 @@ class {cleanTypename}_SQL(Base):
if isChoice:
g_sqlalchemyOutput.write(
' '
'if self.kind == DV.' + c[-1] + ':\n')
'if self.kind == DV.' + c[2] + ':\n')
g_sqlalchemyOutput.write(
' '
'self.{cleanFieldname} = '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment