Skip to content
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

Ensure that Parameterized remaps watchers on copy #409

Merged
merged 2 commits into from
May 12, 2020

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented May 12, 2020

When a Parameterized is (deep)copied the watchers on it are copied along with the rest of the internal state. The problem with this is that these watchers will still call methods on the original, not on the copy. Therefore we have to override __setstate__ behavior to detect internal watchers (i.e. methods on the instance and those set up by decorating methods using @param.depends(..., watch=True)) and correctly copy them.

Fixes #407

  • Add tests

Ping @sdc50

@coveralls
Copy link

coveralls commented May 12, 2020

Coverage Status

Coverage increased (+0.2%) to 76.452% when pulling a604900 on philippjfr/407_watcher_copy into f1ea7a9 on master.

@jbednar jbednar merged commit a8e34b2 into master May 12, 2020
@jbednar jbednar deleted the philippjfr/407_watcher_copy branch May 12, 2020 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassSelector instantiate does not interact well with param.depends
3 participants