Update code to work with pickling (#327)
authorVal <valdeg6@gmail.com>
Sat, 25 Jul 2020 12:22:10 +0000 (08:22 -0400)
committerGitHub <noreply@github.com>
Sat, 25 Jul 2020 12:22:10 +0000 (05:22 -0700)
elftools/construct/core.py

index 214c58fc082acb0735e22e6b2480c5244d1a5d03..14a50f88e9b08e4980aec964990e480379e31321 100644 (file)
@@ -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):