diff --git a/lark/lark.py b/lark/lark.py index 8799610..8dba091 100644 --- a/lark/lark.py +++ b/lark/lark.py @@ -336,7 +336,8 @@ class Lark(Serialize): Useful for caching and multiprocessing. """ data, m = self.memo_serialize([TerminalDef, Rule]) - pickle.dump({'data': data, 'memo': m}, f) + pickle.dump({'data': data, 'memo': m}, f, + protocol=pickle.HIGHEST_PROTOCOL) @classmethod def load(cls, f): diff --git a/tests/test_cache.py b/tests/test_cache.py index ca4d781..1775e99 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -93,6 +93,3 @@ class TestCache(TestCase): if __name__ == '__main__': main() - - - diff --git a/tests/test_trees.py b/tests/test_trees.py index cca92f9..905ad5a 100644 --- a/tests/test_trees.py +++ b/tests/test_trees.py @@ -20,7 +20,7 @@ class TestTrees(TestCase): def test_pickle(self): s = copy.deepcopy(self.tree1) - data = pickle.dumps(s) + data = pickle.dumps(s, protocol=pickle.HIGHEST_PROTOCOL) assert pickle.loads(data) == s def test_repr_runnable(self):