tomate44 / CurvesWB

Experiments for a FreeCAD Surface workbench
GNU Lesser General Public License v2.1
105 stars 21 forks source link

Fix issue #97 Object of type FeaturePython is not JSON serializable #98

Closed fra589 closed 9 months ago

fra589 commented 9 months ago

Since Py3.11 the methods names setstate and getstate conflict with the method names added to the object class. In the FreeCAD dev (0.22 and more) the methods named setstate and getstate have been renamed to 'loads' and 'dumps'. This have been published in the FreeCAD App: Fixe #10460

This patch add a test of FreeCAD version, and if it's >0.22, expose the 'loads' and 'dumps' methods, if the version is less than 0.22, the __setstate__ and __getstate__ methods are exposed.

This path have been tested on Linux (Debian 12.2 / FreeCAD dev 0.22) and Windows 10, FreeCAD 0.20 & 0.21

@++; Gauthier.

tomate44 commented 9 months ago

Merged. Thank you.

fra589 commented 9 months ago

De rien ! :-) Dans mon fix, je n'ai pas mis à jour la version... Je te laisse le faire.


Your welcome ! :-) In the fix, I didn't update the version... I'll let you do it.