Skip to content

Commit

Permalink
Fix bug in FunctionRunner function deserialisation
Browse files Browse the repository at this point in the history
In h5py 3.0, all strings from datasets are returned as bytestrings:

h5py/h5py#1338

Luckily this isn't more of an issue throughout the labscript suite,
because we still have lots of code that is unassuming about string
datatypes due to the port from Python 2. But it will probably show up
elsewhere too.
  • Loading branch information
chrisjbillington committed Aug 20, 2021
1 parent 75b175d commit 9dc2162
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions labscript_devices/FunctionRunner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def deserialise_function(
"""Deserialise a function that was serialised by serialise_function. Optional
__name__ and __file__ arguments set those attributes in the namespace that the
function will be defined."""
if isinstance(name, bytes):
name = name.decode('utf8')
args = deserialise(args)
kwargs = deserialise(kwargs)
code = compile(source, '<string>', 'exec', dont_inherit=True,)
Expand Down

0 comments on commit 9dc2162

Please sign in to comment.