From facb1cca31c0a628c061a3810c64c06f662df14b Mon Sep 17 00:00:00 2001 From: Tohka Date: Sun, 24 Apr 2016 12:37:34 +0300 Subject: [PATCH] Fix several Sequence crashes (#99) tuple and list shouldn't be used as parameter names. With the new Python 2.7.11 these break Sequences altogether. --- direct/src/interval/MetaInterval.py | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/direct/src/interval/MetaInterval.py b/direct/src/interval/MetaInterval.py index d7b23afdeb..dc83f3587c 100644 --- a/direct/src/interval/MetaInterval.py +++ b/direct/src/interval/MetaInterval.py @@ -268,7 +268,7 @@ class MetaInterval(CMetaInterval): self.addInterval(ival, maxDuration - ival.getDuration(), TRACK_START) self.popLevel(duration) - def addTrack(self, list, name, relTime, relTo, duration): + def addTrack(self, trackList, name, relTime, relTo, duration): # Adds a "track list". This is a list of tuples of the form: # # (, , @@ -281,19 +281,19 @@ class MetaInterval(CMetaInterval): # (TRACK_START). If the relative code is omitted, the default # is TRACK_START. self.pushLevel(name, relTime, relTo) - for tuple in list: - if isinstance(tuple, tuple) or \ - isinstance(tuple, list): - relTime = tuple[0] - ival = tuple[1] - if len(tuple) >= 3: - relTo = tuple[2] + for tupleObj in trackList: + if isinstance(tupleObj, tuple) or \ + isinstance(tupleObj, list): + relTime = tupleObj[0] + ival = tupleObj[1] + if len(tupleObj) >= 3: + relTo = tupleObj[2] else: relTo = TRACK_START self.addInterval(ival, relTime, relTo) else: - self.notify.error("Not a tuple in Track: %s" % (tuple,)) + self.notify.error("Not a tuple in Track: %s" % (tupleObj,)) self.popLevel(duration) def addInterval(self, ival, relTime, relTo): @@ -593,22 +593,22 @@ class Track(MetaInterval): meta.addTrack(self.ivals, self.getName(), relTime, relTo, self.phonyDuration) - def validateComponent(self, tuple): + def validateComponent(self, tupleObj): # This is called only in debug mode to verify that the # indicated component added to the MetaInterval is appropriate # to this type of MetaInterval. In most cases except Track, # this is the same as asking that the component is itself an # Interval. - if not (isinstance(tuple, tuple) or \ - isinstance(tuple, list)): + if not (isinstance(tupleObj, tuple) or \ + isinstance(tupleObj, list)): # It's not a tuple. return 0 - relTime = tuple[0] - ival = tuple[1] - if len(tuple) >= 3: - relTo = tuple[2] + relTime = tupleObj[0] + ival = tupleObj[1] + if len(tupleObj) >= 3: + relTo = tupleObj[2] else: relTo = TRACK_START