diff --git a/src/packaging/tags.py b/src/packaging/tags.py index f5903402..87bab4d9 100644 --- a/src/packaging/tags.py +++ b/src/packaging/tags.py @@ -92,6 +92,13 @@ def __str__(self) -> str: def __repr__(self) -> str: return f"<{self} @ {id(self)}>" + def __setstate__(self, state): + # cached _hash is wrong when unpickling + _, slots = state + for slot in slots: + setattr(self, slot, slots[slot]) + self._hash = hash((self._interpreter, self._abi, self._platform)) + def parse_tag(tag: str) -> frozenset[Tag]: """