Support __setstate__ for custom state of python objects
#2300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Supported serialisation and deserialsation of python objects that have custom states (e.g. have
__slots__with a list of valid attributes). For these objects we should use__reduce_ex__method instead of__reduce__to serialise if it is possible and then use custom method__setstate__to deserialise state.Changes in
utbot-executor: tamarinvs19/utbot_executor#1How to test
Automated tests
There are tests for serialization and deserialization processes in
utbot-executor(utbot_executor/deep_serialization/tests.py)Manual tests
See example
utbot-python/samples/easy_samples/setstate_test.pyExpected: success test generation for
make_my_classSelf-check list
Check off the item if the statement is true. Hint: [x] is a marked item.
Please do not delete the list or its items.