Closed James-Oswald closed 1 year ago
The cache hashing mechanism appears to break my ability to deepcopy or pickle any of the core objects.
Minimally reproducible example for domains, same issue with actions and problems
import copy import pickle import traceback from pddl.parser.domain import DomainParser domain_str = """ (define (domain test) (:requirements :typing) (:types t1) (:constants c1 - t1) (:predicates (p1 ?v1 - t1)) (:action a1 :parameters (?v - t1) :effect (c1)) )""" domain = DomainParser()(domain_str) #Deep copy domains try: copy.deepcopy(domain) except Exception: print(traceback.format_exc()) #Pickle domains try: pickle.dumps(domain) except Exception: print(traceback.format_exc())
I should get a deepcopied/pickled domain/action/problem without any errors occurring.
All fails with KeyError: 'hash' in the `d.pop("hash")oncache_hash.py` line 56.
on
Thank you @James-Oswald for the issue. This is indeed an unintended behaviour.
Thanks for the speedy fix!
Subject of the issue
The cache hashing mechanism appears to break my ability to deepcopy or pickle any of the core objects.
Your environment
Steps to reproduce
Minimally reproducible example for domains, same issue with actions and problems
Expected behaviour
I should get a deepcopied/pickled domain/action/problem without any errors occurring.
Actual behaviour
All fails with KeyError: 'hash' in the `d.pop("hash")
on
cache_hash.py` line 56.