-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REF-647] deepcopy
on rx.Model not working
#1841
Comments
deepcopy
on rx.Model not workingdeepcopy
on rx.Model not working
Fairly sure this was introduced via #1748, which wraps When I run the provided code (with slight modifications), I get Traceback (most recent call last):
File "/Users/masenf/code/reflex-dev/VENV-repro-6/lib/python3.11/site-packages/reflex/state.py", line 816, in _process_event
events = fn(**payload)
^^^^^^^^^^^^^
File "/Users/masenf/code/reflex-dev/repro-1841/repro_1841/repro_1841.py", line 14, in print_deepcopy
print(deepcopy(self.my_model))
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/copy.py", line 153, in deepcopy
y = copier(memo)
^^^^^^^^^^^^
NotImplementedError: object proxy must define __deepcopy__() Sounds like I need to make the new Thank you @jpbaltazar for reporting this issue on pre-release code so we can get it fixed! 🙏 |
Allow state vars accessed through MutableProxy to be copied and unconnected from the proxy. Copied objects that are modified will not mark the associated field on the state as dirty. Fix #1841 Fix REF-647
Thank you so much for solving this in record time! I'm glad to be able to at least contribute to this project in this way :) |
Hi I've been using
deepcopy
to transform some complex rx.Model entities onto dictionaries of primitives and I've verified it works up until version 2.7 but after some recent commit it stops working.A minimal example to reproduce this issue:
From SyncLinear.com | REF-647
The text was updated successfully, but these errors were encountered: