I have an object which has a list of Point3D as an attribute, when two or more points are equal, I have a problem with the to_dict (_check_platform).
NOTE: I think that we never entered this condition to trigger the error.
obj_._check_platform() Checking serialization process... Serialized. Deserializing... ['#/list_point/2'] Traceback (most recent call last): File "/home/younes/.local/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3442, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-f52ad432efb9>", line 1, in <module> obj_._check_platform() File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/core.py", line 495, in _check_platform return self.check_platform().raise_if_above_level(level=level) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/core.py", line 499, in check_platform serializable_results = dcc.check_serialization_process(object_=self, use_pointers=True) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/checks.py", line 177, in check_serialization_process deserialized_object = object_.dict_to_object(decoded_json) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 72, in dict_to_object return dict_to_object(dict_=dict_, force_generic=force_generic, global_dict=global_dict, File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 307, in dict_to_object global_dict, pointers_memo = update_pointers_data(global_dict=global_dict, current_dict=dict_, File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 630, in update_pointers_data pointers_memo.update(dereference_jsonpointers(current_dict)) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 671, in dereference_jsonpointers order = deserialization_order(dict_) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 644, in deserialization_order raise NotImplementedError('Cycles in jsonpointers not handled') NotImplementedError: Cycles in jsonpointers not handled
in the json we can clearly see that the reference of the 3rd point is not clearly indicated (file: obj_list_point_bug) with this PR this is fixed https://github.com/Dessia-tech/dessia_common/pull/629 (file: obj_list_point)
-- Exemple to reproduce the bug:
`from typing import List
import volmdlr
from dessia_common.core import DessiaObject
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Avoid reference to other packages
What is the expected behavior?
What is the motivation / use case for changing the behavior?
**Note: for support questions, please use https://nextcloud.dessia.tech/call/hr9z9bif
I'm submitting a ...
What is the current behavior?
I have an object which has a list of Point3D as an attribute, when two or more points are equal, I have a problem with the to_dict (_check_platform).
NOTE: I think that we never entered this condition to trigger the error.
obj_._check_platform() Checking serialization process... Serialized. Deserializing... ['#/list_point/2'] Traceback (most recent call last): File "/home/younes/.local/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3442, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-3-f52ad432efb9>", line 1, in <module> obj_._check_platform() File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/core.py", line 495, in _check_platform return self.check_platform().raise_if_above_level(level=level) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/core.py", line 499, in check_platform serializable_results = dcc.check_serialization_process(object_=self, use_pointers=True) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/checks.py", line 177, in check_serialization_process deserialized_object = object_.dict_to_object(decoded_json) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 72, in dict_to_object return dict_to_object(dict_=dict_, force_generic=force_generic, global_dict=global_dict, File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 307, in dict_to_object global_dict, pointers_memo = update_pointers_data(global_dict=global_dict, current_dict=dict_, File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 630, in update_pointers_data pointers_memo.update(dereference_jsonpointers(current_dict)) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 671, in dereference_jsonpointers order = deserialization_order(dict_) File "/home/younes/Bureau/DESSIA_WORK/dessia_common/dessia_common/serialization.py", line 644, in deserialization_order raise NotImplementedError('Cycles in jsonpointers not handled') NotImplementedError: Cycles in jsonpointers not handled
in the json we can clearly see that the reference of the 3rd point is not clearly indicated (file: obj_list_point_bug) with this PR this is fixed https://github.com/Dessia-tech/dessia_common/pull/629 (file: obj_list_point)
-- Exemple to reproduce the bug:
`from typing import List
import volmdlr from dessia_common.core import DessiaObject
class ToDictTest(DessiaObject):
pt_1 = volmdlr.Point3D(0, 1, 3) pt_2 = volmdlr.Point3D(1, 2, 5) pt_3 = volmdlr.Point3D(0, 1, 3)
obj_ = ToDictTest(list_point=[pt_1, pt_2, pt_3]) `
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Avoid reference to other packages
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Possible fixes https://github.com/Dessia-tech/dessia_common/pull/629
Please tell us about your environment:
obj_list_point.json obj_list_point_bug.json