spec.py: fix hash change due to None vs {} (#48854)

* Fix hash change due to None vs {}

* Enforce null for empty list of external_modules
This commit is contained in:
Harmen Stoppels 2025-02-05 09:48:00 +01:00 committed by GitHub
parent d34b709425
commit fbb688af07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1527,9 +1527,8 @@ def __init__(self, spec_like=None, *, external_path=None, external_modules=None)
self._external_path = external_path
self.external_modules = Spec._format_module_list(external_modules)
# This attribute is used to store custom information for
# external specs. None signal that it was not set yet.
self.extra_attributes = None
# This attribute is used to store custom information for external specs.
self.extra_attributes: dict = {}
# This attribute holds the original build copy of the spec if it is
# deployed differently than it was built. None signals that the spec
@ -2351,15 +2350,10 @@ def to_node_dict(self, hash=ht.dag_hash):
)
if self.external:
if self.extra_attributes:
extra_attributes = syaml.sorted_dict(self.extra_attributes)
else:
extra_attributes = None
d["external"] = {
"path": self.external_path,
"module": self.external_modules,
"extra_attributes": extra_attributes,
"module": self.external_modules or None,
"extra_attributes": syaml.sorted_dict(self.extra_attributes),
}
if not self._concrete: