Fix EnumValue pickling for protocol 2

This commit is contained in:
Clement Rouault
2017-08-10 17:07:41 +02:00
parent 928a2744d5
commit 61ac5c8c5d
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -270,6 +270,10 @@ class StructGenerator(CtypesGenerator):
def __repr__(self):
return "{0}.{1}({2})".format(self.enum_name, self.name, hex(self))
# Fix pickling with protocol 2
def __getnewargs__(self, *args):
return self.enum_name, self.name, int(self)
class EnumType(DWORD):
values = ()
+4
View File
@@ -103,6 +103,10 @@ class EnumValue(Flag):
def __repr__(self):
return "{0}.{1}({2})".format(self.enum_name, self.name, hex(self))
# Fix pickling with protocol 2
def __getnewargs__(self, *args):
return self.enum_name, self.name, int(self)
class EnumType(DWORD):
values = ()