Serialization of Unions uses wrong type tag
jlacomis opened this issue · 0 comments
I received an email confused about the Void type in data that looked like a Union. It turns out there is a subtle bug in the serialization code here:
Lines 918 to 924 in f1f24f4
This caused Unions to be serialized with the Void meta-tag. During deserialization, these are treated as Void types:
Lines 1041 to 1065 in f1f24f4
The serialization bug is simple enough to fix, but this means that the current dataset has this specific bug. I will fix the current dataset, but if you've already downloaded the current one and/or don't want to wait, you'll have to modify the read_metadata
method to condition on d
having other fields, for example by replacing line 1065 in dire_types.py
with this (untested) code:
if d["T"] == 8:
if "m" in d:
return Union._from_json(d)
return Void._from_json(d)
return classes[d["T"]]._from_json(d)