Skip to content

Commit

Permalink
Fix bug where FunctionRunner functions were sorted by name
Browse files Browse the repository at this point in the history
Instead of remaining in the order they were added. Functions are
intended to be sorted by time, but not by anything else. But naively
sorting the tuples caused them to be sorted unintentionally by name if
they had the same time.
  • Loading branch information
chrisjbillington committed Aug 20, 2021
1 parent 75b175d commit 0e85f73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion labscript_devices/FunctionRunner/labscript_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def func(shot_context, t, ...):
def generate_code(self, hdf5_file):
# Python's sorting is stable, so items with equal times will remain in the order
# they were added
self.functions.sort()
self.functions.sort(key=lambda item: item[0])
vlenstr = h5py.special_dtype(vlen=str)
table_dtypes = [
('t', float),
Expand Down

0 comments on commit 0e85f73

Please sign in to comment.