We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d813dd commit 339d62fCopy full SHA for 339d62f
immutables/map.py
@@ -722,6 +722,9 @@ def __repr__(self):
722
def __len__(self):
723
return self.__count
724
725
+ def __reduce__(self):
726
+ raise TypeError("can't pickle {} objects".format(type(self).__name__))
727
+
728
def __hash__(self):
729
raise TypeError('unhashable type: {}'.format(type(self).__name__))
730
tests/test_map.py
@@ -1254,6 +1254,9 @@ def test_map_pickle(self):
1254
self.assertTrue(isinstance(uh, self.Map))
1255
self.assertEqual(h, uh)
1256
1257
+ with self.assertRaisesRegex(TypeError, "can't pickle"):
1258
+ pickle.dumps(h.mutate())
1259
1260
1261
class PyMapTest(BaseMapTest, unittest.TestCase):
1262
0 commit comments