From 619ba26dfe5aadb755c56b015a7318eae982f125 Mon Sep 17 00:00:00 2001 From: Val Date: Sat, 25 Jul 2020 08:22:10 -0400 Subject: [PATCH] Update code to work with pickling (#327) --- elftools/construct/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elftools/construct/core.py b/elftools/construct/core.py index 214c58f..14a50f8 100644 --- a/elftools/construct/core.py +++ b/elftools/construct/core.py @@ -345,7 +345,7 @@ class FormatField(StaticField): return attrs def __setstate__(self, attrs): attrs["packer"] = Packer(attrs["packer"]) - return StaticField.__setstate__(attrs) + return StaticField.__setstate__(self, attrs) def _parse(self, stream, context): try: return self.packer.unpack(_read_stream(stream, self.length))[0] @@ -1297,6 +1297,8 @@ class Pass(Construct): assert obj is None def _sizeof(self, context): return 0 + def __reduce__(self): + return self.__class__.__name__ Pass = Pass(None) class Terminator(Construct): -- 2.30.2