So I encountered a error when I want make a deep copy of a RobotModel.
Then I notice that since we adopted compas.Data, we never tested the copy mechanism and the correctness of its result.
I have nailed down the error to how deepcopy treats objects when they are in a dictionary, and for some reason beyond my comprehension, there is a _deepcopy_dict function inside Python that is not happy with how we modified the ProxyObject.__get_attr__, this resulted in a recursion error when the ProxyObject is being deepcopied.
By introducing the __deep_copy__ function, somehow it breaks this loop.
By the way, as discussed with @gonzalocasas , we will drop support for Python 3.8 because of EOL, and we will update the requirements for compas to 2.3 to match accordingly. I'm not sure if this will requires a major version release?
What type of change is this?
[x] Bug fix in a backwards-compatible manner.
[ ] New feature in a backwards-compatible manner.
[ ] Breaking change: bug fix or new feature that involve incompatible API changes.
[ ] Other (e.g. doc update, configuration, etc)
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
[x] I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
[x] I ran all tests on my computer and it's all green (i.e. invoke test).
[ x I ran lint on my computer and there are no errors (i.e. invoke lint).
[x] I have added tests that prove my fix is effective or that my feature works.
[ ] I have added necessary documentation (if appropriate)
So I encountered a error when I want make a deep copy of a RobotModel. Then I notice that since we adopted compas.Data, we never tested the copy mechanism and the correctness of its result.
I have nailed down the error to how deepcopy treats objects when they are in a dictionary, and for some reason beyond my comprehension, there is a
_deepcopy_dict
function inside Python that is not happy with how we modified theProxyObject.__get_attr__
, this resulted in a recursion error when the ProxyObject is being deepcopied.By introducing the
__deep_copy__
function, somehow it breaks this loop.By the way, as discussed with @gonzalocasas , we will drop support for Python 3.8 because of EOL, and we will update the requirements for compas to 2.3 to match accordingly. I'm not sure if this will requires a major version release?
What type of change is this?
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.md
file in theUnreleased
section under the most fitting heading (e.g.Added
,Changed
,Removed
).invoke test
).invoke lint
).