Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tehrengruber committed Feb 14, 2025
1 parent 4dbac3b commit 06842c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gt4py/next/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def replace(self, index: int | Dimension, *named_ranges: NamedRange) -> Domain:

return Domain(dims=dims, ranges=ranges)

def __getstate__(self):
def __getstate__(self) -> dict[str, Any]:
state = self.__dict__.copy()
# remove cached property
state.pop("slice_at", None)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2024, ETH Zurich
# All rights reserved.
#
# Please, refer to the LICENSE file in the root directory.
# SPDX-License-Identifier: BSD-3-Clause

import pickle

from gt4py.next import common

I = common.Dimension("I")
J = common.Dimension("J")


def test_domain_pickle_after_slice():
domain = common.domain(((I, (2, 4)), (J, (3, 5))))
# use slice_at to populate cached property
domain.slice_at[2:5, 5:7]

pickle.dumps(domain)
pickle.dumps(domain)

0 comments on commit 06842c2

Please sign in to comment.