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 edit_constant resets class and instance level parameters #1015

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Feb 11, 2025

Fixes #1014
Fixes #931

Regression introduced in Param 2.0.0 in #826 that introduced installing an instance parameter (copied from the class) on __set__ (6ce1ef3). The context manager edit_constant was first getting a handle on all the existing parameters (mix of class and instance level parameters), yielding, and then resetting constant on the parameters already handled, missing that the parameterized object could have been equipped with instance-level parameters that were created with constant=False.

This is fixed in this MR, which also only touches the constant parameters.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.27%. Comparing base (8095bb3) to head (87b16ca).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1015      +/-   ##
==========================================
+ Coverage   87.25%   87.27%   +0.01%     
==========================================
  Files           9        9              
  Lines        4928     4934       +6     
==========================================
+ Hits         4300     4306       +6     
  Misses        628      628              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems correct to me. Thanks!

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.

Unexpected behaviour of param.edit_constant() context manager Initialization changes constant attribute.
2 participants