mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 11:08:03 +00:00
ifcdiff: fix crash when exporting property diffs to JSON
DeepDiff's dictionary_item_added/set_item_added results are a
deepdiff.helper.SetOrdered instance, which subclasses orderly_set's
StableSetEq rather than the OrderedSet class json_dump_default checked
for, so the property relationship check always crashed export() with
"Object of type SetOrdered is not JSON serializable". Check against
StableSet, the common base class shared by every orderly_set set
flavour, instead.
Fixes #8905
Generated with the assistance of an AI coding tool.
(cherry picked from commit fbe36532a0)
This commit is contained in:
committed by
Dion Moult
parent
3f2fbcd12d
commit
82efde5741
@@ -36,7 +36,7 @@ import ifcopenshell.util.representation
|
||||
import ifcopenshell.util.selector
|
||||
import numpy as np
|
||||
from deepdiff import DeepDiff
|
||||
from orderly_set import OrderedSet
|
||||
from orderly_set import StableSet
|
||||
|
||||
__version__ = version = "0.0.0"
|
||||
|
||||
@@ -257,7 +257,7 @@ class IfcDiff:
|
||||
|
||||
def json_dump_default(self, obj):
|
||||
# result of DeepDiff may contain ordered sets
|
||||
if isinstance(obj, (OrderedSet, set)):
|
||||
if isinstance(obj, (StableSet, set)):
|
||||
return list(obj)
|
||||
return json.JSONEncoder.default(None, obj)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user