Skip to content

Commit b4b5dec

Browse files
bourgeslmax-wittig
authored andcommitted
fix: improve pickle support
1 parent 262b222 commit b4b5dec

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

gitlab/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __getstate__(self):
5252
def __setstate__(self, state):
5353
module_name = state.pop("_module_name")
5454
self.__dict__.update(state)
55-
self._module = importlib.import_module(module_name)
55+
self.__dict__["_module"] = importlib.import_module(module_name)
5656

5757
def __getattr__(self, name):
5858
try:

gitlab/tests/test_base.py

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def test_pickability(self):
9393
self.assertIsInstance(unpickled, FakeObject)
9494
self.assertTrue(hasattr(unpickled, "_module"))
9595
self.assertEqual(unpickled._module, original_obj_module)
96+
pickled2 = pickle.dumps(unpickled)
9697

9798
def test_attrs(self):
9899
obj = FakeObject(self.manager, {"foo": "bar"})

0 commit comments

Comments
 (0)